Container group quantity adjusting method and device of container cluster, equipment and medium

By predicting pressure values using historical access request data and adjusting container groups based on multiple indicators, the method enhances the accuracy and efficiency of Kubernetes cluster resource management, addressing the inefficiencies of existing CPU and memory-based scaling methods.

CN119109786APending Publication Date: 2024-12-10CCB FINTECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411370187.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Existing Kubernetes clusters inaccurately adjust the number of container groups based on CPU and memory usage, failing to reflect the actual processing capacity for access request data, leading to inefficiencies and resource bottlenecks.

Method used

A method that predicts the pressure value of a container cluster using historical access request data, incorporating multiple monitoring indicators like request volume, success rate, and response time, and adjusts container groups dynamically when inconsistencies are detected, ensuring timely and accurate scaling.

Benefits of technology

Improves the accuracy of container group adjustments by predicting pressure values through comprehensive evaluation of historical data, allowing for timely and efficient resource allocation, reducing bottlenecks and optimizing resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109786A_ABST
    Figure CN119109786A_ABST
Patent Text Reader

Abstract

The invention discloses a container group quantity adjusting method and device of a container cluster, equipment and a medium, and relates to the technical field of cloud computing. The method comprises the steps that historical access request data passing through a container cluster access entrance within a preset time period before a target moment and the number of first container groups of a container cluster at the target moment are acquired, and the historical access request data comprise a plurality of monitoring indexes and monitoring data of each monitoring index; determining a pressure value of the container cluster at the target moment according to the monitoring data of each monitoring index and a first preset weight; under the condition that the pressure value meets a preset condition, the number of second container groups corresponding to the pressure value is determined according to the relation between the preset pressure value and the number of preset container groups; and under the condition that the number of the first container groups and the number of the second container groups are inconsistent, adjusting the number of the first container groups of the container cluster at the target moment to be the number of the second container groups. And the accuracy of the container group number is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of cloud computing technology, and in particular, relates to a method, device, equipment and medium for adjusting the number of container groups in a container cluster. Background Art

[0002] Kubernetes cluster is a distributed system for running containerized applications. It implements cluster management through a master-slave architecture. Container group is the smallest deployment unit in Kubernetes, that is, all resource management and scheduling operations are based on container groups. Each container group can contain one or more containers, which are usually designed to implement a specific application function. For example, in actual applications, container groups may contain different types of containers such as Internet servers and database servers, which work together to complete a complete business process. Kubernetes can adjust the number of container groups according to business needs through the Horizontal Pod Autoscaler (HPA). Under high load, additional container groups are scheduled to handle access requests; when the load decreases, the scheduling of container groups is reduced to save resources. Therefore, it is crucial to accurately adjust the number of container groups.

[0003] In the prior art, HPA in a Kubernetes cluster adjusts the number of container groups based on the level of the central processing unit (CPU) and memory, but the CPU and memory cannot directly reflect the processing capacity of access request data. For example, when the number of user visits increases, the CPU or memory may not increase significantly, but the ability to process access request data may have reached a bottleneck.

[0004] Therefore, the number of container groups adjusted by CPU and memory in the prior art has low accuracy. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device and medium for adjusting the number of container groups of a container cluster. The method predicts a pressure value of a container cluster at a target time based on historical access request data passing through an access portal of the container cluster. When the pressure value satisfies a preset condition, the number of second container groups corresponding to the pressure value is determined. When the number of first container groups and the number of second container groups of the container cluster at the target time are inconsistent, the number of container groups is adjusted. The method predicts the pressure value of the container cluster at the target time through a comprehensive evaluation of the historical access request data. When the number of first container groups of the container cluster at the target time and the number of second container groups corresponding to the predicted pressure value are inconsistent, the number of container groups is adjusted in time, thereby improving the accuracy of the number of container groups.

[0006] In a first aspect, an embodiment of the present application provides a method for adjusting the number of container groups in a container cluster, including:

[0007] Obtain historical access request data that passes through the container cluster access portal within a preset time period before the target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes multiple monitoring indicators and monitoring data of each monitoring indicator;

[0008] Determine a pressure value of the container cluster at a target time according to the monitoring data of each monitoring indicator and the first preset weight;

[0009] When the pressure value satisfies a preset condition, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups, the preset pressure value includes the pressure value, and the preset number of container groups includes the number of second container groups;

[0010] When the number of the first container groups is inconsistent with the number of the second container groups, the number of the first container groups of the container cluster at the target time is adjusted to the number of the second container groups.

[0011] In a possible implementation, the preset time period includes a preset number of sub-preset time periods; and determining the pressure value of the container cluster at the target time according to the monitoring data of each monitoring indicator and the first preset weight includes:

[0012] Determine, according to the monitoring data of each monitoring indicator and the first preset weight, a sub-pressure value of the container cluster in each sub-preset time period;

[0013] The pressure value of the container cluster at the target time is determined according to the sub-pressure value of each sub-preset time period and the second preset weight.

[0014] In a possible implementation, when the pressure value satisfies a preset condition, determining the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups includes:

[0015] When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups.

[0016] In a possible implementation, when the number of the first container groups is inconsistent with the number of the second container groups, after adjusting the number of the first container groups of the container cluster at the target time to the number of the second container groups, the method further includes:

[0017] The container groups are scheduled according to the second container group quantity.

[0018] In a possible embodiment, it also includes:

[0019] When the number of the first container groups is the same as the number of the second container groups, the container groups are scheduled according to the number of the first container groups.

[0020] In a possible embodiment, the multiple monitoring indicators include at least the number of requests, the request success rate and the average response time.

[0021] In a second aspect, an embodiment of the present application provides a device for adjusting the number of container groups of a container cluster, including:

[0022] An acquisition module is used to acquire historical access request data that passes through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes multiple monitoring indicators and monitoring data of each monitoring indicator;

[0023] A determination module, used to determine a pressure value of the container cluster at a target time according to monitoring data of each monitoring indicator and a first preset weight;

[0024] The determination module is further used to determine the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups when the pressure value meets the preset condition, the preset pressure value includes the pressure value, and the preset number of container groups includes the number of second container groups;

[0025] The adjustment module is used to adjust the number of first container groups in the container cluster at a target time to the number of second container groups when the number of first container groups is inconsistent with the number of second container groups.

[0026] In a possible implementation, the preset time period includes a preset number of sub-preset time periods; and the determination module is specifically configured to:

[0027] Determine, according to the monitoring data of each monitoring indicator and the first preset weight, a sub-pressure value of the container cluster in each sub-preset time period;

[0028] The pressure value of the container cluster at the target time is determined according to the sub-pressure value of each sub-preset time period and the second preset weight.

[0029] In one possible implementation, the determination module is specifically used for:

[0030] When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups.

[0031] In a possible embodiment, the device further includes:

[0032] The scheduling module is used to schedule the container groups according to the second container group number after adjusting the first container group number of the container cluster to the second container group number at a target time when the first container group number and the second container group number are inconsistent.

[0033] In a possible embodiment, it also includes:

[0034] The scheduling module is used to schedule the container groups according to the number of the first container groups when the number of the first container groups is consistent with the number of the second container groups.

[0035] In a possible embodiment, the multiple monitoring indicators include at least the number of requests, the request success rate and the average response time.

[0036] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising:

[0037] a processor and a memory storing computer program instructions;

[0038] When the processor executes the computer program instructions, any one of the above methods for adjusting the number of container groups in a container cluster is implemented.

[0039] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, any of the above methods for adjusting the number of container groups in a container cluster is implemented.

[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, characterized in that when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-mentioned methods for adjusting the number of container groups in a container cluster.

[0041] The method, apparatus, device and medium for adjusting the number of container groups of a container cluster in an embodiment of the present application, the method comprising: obtaining historical access request data passing through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, the historical access request data comprising multiple monitoring indicators and monitoring data of each monitoring indicator; determining a pressure value of the container cluster at the target time according to the monitoring data of each monitoring indicator and a first preset weight; determining the number of second container groups corresponding to the pressure value according to a relationship between the preset pressure value and the preset number of container groups when the pressure value meets a preset condition, the preset pressure value comprising the pressure value, and the preset number of container groups comprising the number of second container groups; and adjusting the number of first container groups of the container cluster at the target time to the number of second container groups when the number of first container groups and the number of second container groups are inconsistent.

[0042] In this way, the pressure value of the container cluster at the target time is predicted based on the historical access request data passing through the container cluster access entrance. When the pressure value meets the preset conditions, the number of second container groups corresponding to the pressure value is determined. When the number of first container groups and the number of second container groups of the container cluster at the target time are inconsistent, the number of container groups is adjusted. Not only is the pressure value of the container cluster at the target time predicted through a comprehensive evaluation of the historical access request data, but also if the number of first container groups of the container cluster at the target time and the number of second container groups corresponding to the predicted pressure value are inconsistent, the number of container groups is adjusted in time, thereby improving the accuracy of the number of container groups. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0044] Figure 1 It is a structural diagram of a system for adjusting the number of container groups in a container cluster provided by an embodiment of the present application;

[0045] Figure 2 is a flowchart of a method for adjusting the number of container groups in a container cluster provided by another embodiment of the present application;

[0046] Figure 3 It is a flowchart of a method for adjusting the number of container groups in a container cluster provided by another embodiment of the present application;

[0047] Figure 4 It is a flowchart of a method for adjusting the number of container groups in a container cluster provided in yet another embodiment of the present application;

[0048] Figure 5 It is a flowchart of a method for adjusting the number of container groups in a container cluster provided in yet another embodiment of the present application;

[0049] Figure 6 It is a flowchart of a method for adjusting the number of container groups in a container cluster provided in yet another embodiment of the present application;

[0050] Figure 7 is a structural schematic diagram of a device for adjusting the number of container groups in a container cluster provided in yet another embodiment of the present application;

[0051] Figure 8 It is a structural diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION

[0052] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0053] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0054] It should be noted that the acquisition, storage, use and processing of data in the embodiments of the present application are in compliance with the relevant provisions of national laws and regulations.

[0055] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0056] Kubernetes cluster is a distributed system for running containerized applications. It implements cluster management through a master-slave architecture and can automate the deployment, expansion and management of application containers. Container group is the smallest deployment unit in Kubernetes, that is, all resource management and scheduling operations are based on container groups. Each container group can contain one or more containers, which are usually designed to implement a specific application function. For example, in actual applications, container groups may contain different types of containers such as Internet servers and database servers, which work together to complete a complete business process. Kubernetes can adjust the number of container groups according to business needs through the horizontal container group autoscaler (Horizontal pod Autoscaler, HPA). Under high load, additional container groups are scheduled to handle access requests; when the load decreases, the scheduling of container groups is reduced to save resources. Therefore, it is crucial to accurately adjust the number of container groups.

[0057] In the prior art, HPA in a Kubernetes cluster adjusts the number of container groups based on the level of the central processing unit (CPU) and memory. However, the CPU and memory cannot directly reflect the processing capacity of access request data. For example, when the number of user visits increases, the CPU or memory may not increase significantly, but the capacity to process access request data may have reached a bottleneck. Therefore, the accuracy of the number of container groups adjusted by CPU and memory in the prior art is low.

[0058] In order to solve the problems of the prior art, the embodiments of the present application provide a method, device, equipment and medium for adjusting the number of container groups of a container cluster. The method for adjusting the number of container groups of a container cluster provided in the embodiments of the present application predicts the pressure value of the container cluster at a target time based on the historical access request data passing through the access entrance of the container cluster, determines the number of second container groups corresponding to the pressure value when the pressure value meets the preset conditions, and adjusts the number of container groups when the number of first container groups and the number of second container groups of the container cluster at the target time are inconsistent. The method not only predicts the pressure value of the container cluster at the target time through a comprehensive evaluation of the historical access request data, but also adjusts the number of container groups in a timely manner if the number of first container groups of the container cluster at the target time and the number of second container groups corresponding to the predicted pressure value are inconsistent, thereby improving the accuracy of the number of container groups.

[0059] The method for adjusting the number of container groups in a container cluster provided in the embodiment of the present application can be applied to a system for adjusting the number of container groups in a container cluster. Figure 1As shown, the container group quantity adjustment system 100 of the container cluster includes a container cluster access portal 110, a Prometheus module 120, a pressure quantification prediction module 130, a Prometheus adapter 140, an HPA controller 150 and a replica controller 160. The container cluster access portal 110 is used to receive access request data; the Prometheus module 120 is used to collect access request data from the container cluster access portal 110, and obtain the pressure value corresponding to the access request data predicted by the pressure quantification prediction module 130; the Prometheus adapter 140 is used to obtain the pressure value corresponding to the access request data from the Prometheus module 120; the HPA controller 150 is used to control the replica controller 160 to adjust the number of container groups according to the predicted pressure value.

[0060] It should be noted that the container group is the Pod. The container cluster is the kubernetes cluster. HPA is an automatic expansion mechanism used to automatically expand or shrink the number of Pods in kubernetes. HPA can automatically adjust the number of Pods based on observed CPU, memory usage or custom metrics. Prometheus is an open source service monitoring system and time series database designed specifically for monitoring and alerting. The Prometheus adapter connects the Prometheus module and the kubernetes cluster, converting the data of the Prometheus module into data that the kubernetes cluster can recognize. The container cluster access portal (such as the ingress controller) is a component in the kubernetes cluster, which is used to implement the portal for external access to services in the kubernetes cluster. It is implemented based on the kubernetes ingress resource (an application programming interface (API) object) and provides http and https routing functions so that external traffic can reach services within the cluster. The replication controller (RC) is a kubernetes resource object that defines a desired number of Pod replicas to ensure that at any time, a specified number of Pods are running in the kubernetes cluster.

[0061] Here, the number of Pod replicas refers to the number of instances of the same type of service that can run in Kubernetes. The number of container groups involved in the embodiment of the present application refers to the number of Pod replicas. Among them, the number of container groups involved in the embodiment of the present application includes the number of first container groups, the number of second container groups, and the number of preset container groups.

[0062] The following first introduces the method for adjusting the number of container groups in a container cluster provided in an embodiment of the present application. Figure 2As shown, the method for adjusting the number of container groups in a container cluster provided in an embodiment of the present application includes the following steps.

[0063] S210: Acquire historical access request data that passes through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes multiple monitoring indicators and monitoring data of each monitoring indicator.

[0064] Here, the target time refers to the time when it is necessary to determine whether to adjust the number of container groups. The access portal of the container cluster includes the ingress controller. The ingress controller can be implemented by a third-party component, such as nginx-ingress. This component will expose the monitoring data of multiple monitoring indicators of the access request data, and the Prometheus module deployed in the cluster will collect these monitoring data. The historical access request data is obtained from the Prometheus module. The number of container groups refers to the number of container groups, that is, the number of Pods, that is, the number of Pod replicas, which refers to the number of instances of the same type of service that can run in Kubernetes.

[0065] In some embodiments, the monitoring indicators include indicators that characterize the pressure value of the container cluster, such as the number of visits, the number of processed requests, the success rate, the response time, etc.

[0066] In some embodiments, the first number of container groups at the target time may be the number of container groups adjusted within a preset time period before the target time, or may be a preset number of container groups.

[0067] It should be noted that all access request data received by the container cluster from outside the container cluster needs to pass through the container cluster access portal and be forwarded to other backend services in the cluster.

[0068] S220: Determine a pressure value of the container cluster at a target time according to the monitoring data of each monitoring indicator and a first preset weight.

[0069] Here, the first preset weight is set in advance.

[0070] In some embodiments, one monitoring indicator corresponds to one first preset weight. The first preset weights of each monitoring indicator may be the same or different.

[0071] In some embodiments, the plurality of monitoring indicators include at least the number of requests, the request success rate, and the average response time.

[0072] Specifically, the number of requests is the number of access request data received by the container cluster within a preset time period, such as the number of access request data received per second, which directly reflects the access pressure. The request success rate is the ratio of the number of access response data generated by the container cluster to the number of access request data received, that is, the proportion of access request data that responds successfully, which reflects the stability and health, usually expressed as a percentage or decimal (for example, 90% = 0.9). The average response time is the average waiting time for access request data, that is, the average response delay for access request data, which is an important indicator of user experience and system performance, usually in milliseconds (ms). In this way, the three indicators that characterize the pressure value of the container cluster, namely the number of requests, request success rate, and average response time, are used to predict the pressure value of the container cluster at the target time, avoiding the inaccuracy of the prediction results caused by the inaccuracy of a single indicator data, thereby improving the accuracy of the number of container groups.

[0073] In some embodiments, since these monitoring indicators have different units and ranges, it is necessary to normalize their monitoring data to the same scale for weighted summation. As an example, the normalization process is as follows:

[0074] a. Normalized request number: Determine the reasonable range of the request number, which depends on factors such as the current application, server configuration, and expected workload. For example, assuming that the number of requests that the application can handle is 2000, the normal range of the number of requests is 500 to 2000. When the number of requests is less than 500, it is normalized to 0, and when the number of requests is greater than 2000, it is normalized to 1. When the number of requests is between 500 and 2000, the following formula (1) is used for normalization:

[0075]

[0076] Among them, QPS represents the normalized number of requests; min_QPS is 500 and max_QPS is 2000. If QPS is lower than min_QPS, QPS is 0; if QPS is higher than max_QPS, QPS is 1; if it is between 500 and 2000, it changes linearly between 0 and 1.

[0077] It can be understood that min_QPS is the minimum number of requests that can be processed, and max_QPS is the maximum number of requests that can be processed.

[0078] b. Standardized request success rate: Currently it is in percentage or decimal form and can be used directly.

[0079] c. Normalized average response time: You can select a benchmark value (such as the expected maximum average response time) and convert the actual average response time into a ratio relative to this benchmark value. For example, if the expected maximum average response time is 100ms, then an average response time of 50ms can be converted to 0.5 (50 / 100).

[0080] Next, a weighted sum is performed on the standardized monitoring data of each monitoring indicator, where “weight” refers to the first preset weight corresponding to each monitoring indicator, to obtain the pressure value of the container cluster at the target time.

[0081] As an example, the number of requests, request success rate, and average response time are 0.5, 0.3, and 0.2, respectively. The standardized indicator data and the corresponding first preset weight are used to calculate the pressure value of the container cluster at the target time. The calculation formula (2) is as follows:

[0082]

[0083] Among them, QI represents the pressure value of the container cluster at the target time.

[0084] In some embodiments, the obtained pressure value of the container cluster at the target time is pushed to the Prometheus module.

[0085] S230. When the pressure value satisfies a preset condition, determine the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups, where the preset pressure value includes the pressure value and the preset number of container groups includes the number of second container groups.

[0086] Here, the preset condition is set in advance. The relationship between the preset pressure value and the preset number of container groups is set in advance.

[0087] In some embodiments, the preset conditions include a maximum number of copies of the Pod, a minimum number of copies, and a pressure threshold for triggering expansion and contraction, and the pressure threshold includes an upper pressure threshold and an upper pressure threshold.

[0088] It is understandable that the minimum number of replicas is set based on actual conditions. For example, the minimum number of replicas is 1, which is to ensure that there are container groups that can run in the container cluster.

[0089] In some embodiments, the pressure value of the container cluster at the target time is captured from the Prometheus module by using the Prometheus adapter, and format conversion is performed to convert it into a data format recognizable by the HPA controller, and then returned to the HPA controller. Finally, the HPA controller is used to determine the number of second container groups based on the predicted pressure value of the container cluster at the target time based on the preset conditions and the relationship between the preset pressure value and the preset number of container groups.

[0090] S240: When the number of the first container groups is inconsistent with the number of the second container groups, adjust the number of the first container groups of the container cluster at the target time to the number of the second container groups.

[0091] In some embodiments, when the number of first container groups is inconsistent with the number of second container groups, the HPA controller is used to initiate a scaling operation to the replica controller, and the number of first container groups in the container cluster at the target time is adjusted to the number of second container groups to complete the scaling operation.

[0092] In this way, the pressure value of the container cluster at the target time is predicted based on the historical access request data passing through the container cluster access entrance. When the pressure value meets the preset conditions, the number of second container groups corresponding to the pressure value is determined. When the number of first container groups and the number of second container groups of the container cluster at the target time are inconsistent, the number of container groups is adjusted. Not only is the pressure value of the container cluster at the target time predicted through a comprehensive evaluation of the historical access request data, but also if the number of first container groups of the container cluster at the target time and the number of second container groups corresponding to the predicted pressure value are inconsistent, the number of container groups is adjusted in time, thereby improving the accuracy of the number of container groups.

[0093] Based on this, in some embodiments, the preset time period includes a preset number of sub-preset time periods; Figure 3 As shown, the above S220 may specifically include:

[0094] S221. Determine a sub-pressure value of the container cluster in each sub-preset time period according to the monitoring data of each monitoring indicator and the first preset weight;

[0095] S222: Determine a pressure value of the container cluster at a target time according to the sub-pressure value of each sub-preset time period and the second preset weight.

[0096] Here, the preset number of sub-preset time periods may be different collection (or monitoring) cycles. The second preset weight is the weight of different collection (or monitoring) cycles.

[0097] In some embodiments, the actual pressure value of each acquisition cycle is first determined, and then the pressure value at the target moment is determined according to the actual pressure value of each acquisition cycle. Specifically, based on the sub-pressure values ​​in the past preset number of acquisition cycles, the weighted moving average method is used to predict the sub-pressure value at the future moment, and then the predicted sub-pressure value at the future moment is pushed to the Prometheus module.

[0098] As an example, the preset number is 3, the collection period is 1 minute (ie, the duration of the sub-preset time period is 1 minute), the historical access request data within the past 3 minutes is queried from the Prometheus module, and the determined sub-pressure value is shown in Table 1.

[0099] Table 1

[0100] time Sub-pressure value 2 minutes ago 5 1 minute ago 7 Current moment 6

[0101] The weighted moving average method is used to predict the pressure value in the next 1 minute. The calculation formula (3) is as follows:

[0102]

[0103] Among them, Y n+1 represents the weighted average value of the n+1th acquisition cycle, that is, the pressure value in the next minute; Y i Indicates the actual value of the i-th collection cycle, where i refers to the n-th, n-1-th, and n-2-th collection cycles, that is, within the past 3 minutes. i represents the second preset weight of the i-th acquisition cycle.

[0104] Specifically, assuming that the second preset weight distribution is 0.5, 0.3 and 0.2 (corresponding to the current time, 1 minute ago and 2 minutes ago respectively), the Y obtained by calculation using formula (3) is n+1 It is 6.1.

[0105] In this way, the sub-preset time periods farther from the target time and the sub-preset time periods closer to the target time are distinguished, and the second preset weights are set respectively. The time difference of the pressure value is taken into account, and the pressure value of the container cluster at the target time is determined more accurately, thereby improving the accuracy of determining the number of container groups.

[0106] Based on this, in some embodiments, such as Figure 4 As shown, the above S230 may specifically include:

[0107] S231. When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, determine the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups.

[0108] Here, the first threshold and the second threshold are set in advance.

[0109] In some embodiments, the first threshold and the second threshold are the upper pressure threshold and the lower pressure threshold when the number of container groups has not been adjusted. Once the pressure value exceeds the upper pressure threshold or the lower pressure threshold, it is necessary to schedule additional container groups for the excess portion, or to save resources, the container groups are reduced in capacity to reduce the scheduling of container groups.

[0110] It should be noted that the upper pressure threshold and the lower pressure threshold when the number of container groups has not been adjusted refer to the upper pressure threshold and the lower pressure threshold corresponding to the initial number of container groups in the container cluster. In fact, once the pressure value exceeds the upper pressure threshold or the lower pressure threshold, it is necessary to re-determine the number of the second container group of the container group to be scheduled. If the number of the first container group and the number of the second container group of the container cluster at the target time are inconsistent, it means that the number of container groups at the target time is not the most appropriate, that is, there may be a waste of resources, or the problem of not being able to handle access request data well. At this time, it is necessary to adjust the number of the first container group to the number of the second container group.

[0111] In this way, the number of container groups is dynamically adjusted by setting the upper pressure threshold and the lower pressure threshold, so as to achieve timely expansion and contraction of the container group and improve the utilization rate of the container group.

[0112] Based on this, in some embodiments, such as Figure 5 As shown, after the above S240, the method may further include:

[0113] S250: Schedule container groups according to the second number of container groups.

[0114] Here, the second number of container groups is the number of container groups corresponding to the pressure value at the target moment determined according to the relationship between the preset pressure value and the preset number of container groups when the pressure value at the target moment meets the preset condition.

[0115] In some embodiments, scheduling the container groups according to the second number of container groups includes expanding and shrinking the container groups according to the second number of container groups. Specifically, when the second number of container groups is greater than the first number of container groups, additional container groups are scheduled; when the second number of container groups is less than the first number of container groups, scheduling of container groups is reduced.

[0116] In this way, the container groups are scheduled according to the re-determined number of second container groups, thereby improving the utilization rate of the container groups.

[0117] Based on this, in some embodiments, such as Figure 6 As shown, corresponding to the above S240, the method may further include:

[0118] S260: When the number of the first container groups is consistent with the number of the second container groups, schedule the container groups according to the number of the first container groups.

[0119] Here, the first container group quantity is the original container group quantity at the target time.

[0120] In some embodiments, scheduling the container groups according to the first container group quantity means that the scheduling of the container groups remains unchanged, and the scheduling is still performed according to the original first container group quantity.

[0121] In this way, when the number of the first container groups is the same as the number of the second container groups, scheduling is still performed according to the original number of the first container groups, thereby improving the utilization rate of the container groups.

[0122] In the embodiment provided in the present application, historical access request data passing through the access entrance of the container cluster is obtained, and these historical access request data are used as the basis for automatic expansion and contraction of the container cluster; compared with other methods for obtaining access data, there is no intrusion on the application, and no need to modify the application code or customize development. Through the pressure quantification prediction module, the pressure value at the historical moment is determined according to the collected historical access request data, and based on the pressure value at the historical moment, the weighted moving average method of machine learning is used to predict the pressure value at the target moment, and the pressure value at this target moment is pushed to the Prometheus module to guide the HPA controller to expand and contract in advance. Mining multiple indicators such as QPS, request success rate and average response time from historical access request data to comprehensively evaluate the pressure status is more accurate than directly evaluating the pressure status based on CPU, memory or access volume. At the same time, the pressure values ​​obtained by calculating the above-mentioned multiple monitoring indicators are combined with the pressure values ​​in multiple historical monitoring cycles to predict the pressure values ​​at future moments. In this way, automatic expansion and contraction are carried out in advance, and this method is more timely and efficient.

[0123] It should be noted that, in addition to this, the embodiments provided in this application also support horizontal automatic expansion and contraction based on custom monitoring indicators. Custom monitoring indicators need to receive user input, and in most cases, applications need to be modified to expose these custom monitoring indicators, which are collected by the Prometheus module as the basis for automatic expansion and contraction.

[0124] Based on the method for adjusting the number of container groups in a container cluster provided in the above embodiment, the present application also provides a specific implementation of a device for adjusting the number of container groups in a container cluster. Please refer to the following embodiment.

[0125] See also Figure 7 , the container group quantity adjustment device 300 of the container cluster provided in the embodiment of the present application includes:

[0126] An acquisition module 310 is used to acquire historical access request data that passes through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes multiple monitoring indicators and monitoring data of each monitoring indicator;

[0127] A determination module 320, configured to determine a pressure value of the container cluster at a target time according to monitoring data of each monitoring indicator and a first preset weight;

[0128] The determination module 320 is further configured to determine the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups when the pressure value satisfies the preset condition, wherein the preset pressure value includes the pressure value and the preset number of container groups includes the number of second container groups;

[0129] The adjustment module 330 is configured to adjust the number of first container groups in the container cluster at a target time to the number of second container groups when the number of first container groups is inconsistent with the number of second container groups.

[0130] Based on this, in some embodiments, the preset time period includes a preset number of sub-preset time periods; the determination module 320 can be specifically used to:

[0131] Determine, according to the monitoring data of each monitoring indicator and the first preset weight, a sub-pressure value of the container cluster in each sub-preset time period;

[0132] The pressure value of the container cluster at the target time is determined according to the sub-pressure value of each sub-preset time period and the second preset weight.

[0133] Based on this, in some embodiments, the determination module 320 may be specifically used to:

[0134] When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups.

[0135] Based on this, in some embodiments, the apparatus 300 may further include:

[0136] The scheduling module is used to schedule the container groups according to the second container group number after adjusting the first container group number of the container cluster to the second container group number at a target time when the first container group number and the second container group number are inconsistent.

[0137] Based on this, in some embodiments, the apparatus 300 may further include:

[0138] The scheduling module is used to schedule the container groups according to the number of the first container groups when the number of the first container groups is consistent with the number of the second container groups.

[0139] Based on this, in some embodiments, the multiple monitoring indicators include at least the number of requests, the request success rate and the average response time.

[0140] The various modules of the device for adjusting the number of container groups in a container cluster provided in the embodiment of the present application can implement the functions of the various steps of the method for adjusting the number of container groups in a container cluster provided above, and can achieve the corresponding technical effects, which will not be described in detail here for the sake of brevity.

[0141] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.

[0142] Figure 8 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0143] The electronic device may include a processor 401 and a memory 402 storing computer program instructions.

[0144] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0145] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.

[0146] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.

[0147] The processor 401 reads and executes computer program instructions stored in the memory 402 to implement any one of the methods for adjusting the number of container groups in the container cluster in the foregoing embodiments.

[0148] In one example, the electronic device may further include a communication interface 403 and a bus 410. Figure 8As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.

[0149] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0150] The bus 410 includes hardware, software or both, coupling the components of the electronic device to each other. For example, but not limitation, the bus may include an accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, a front side bus (Front Side Bus, FSB), a hypertransport (Hyper Transport, HT) interconnection, an industry standard architecture (Industry Standard Architecture, ISA) bus, an infinite bandwidth interconnection, a low pin count (Linear Predictive Coding, LPC) bus, a memory bus, a micro channel architecture (MicroChannel Architecture, MCA) bus, a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a serial advanced technology attachment (Serial Advanced Technology Attachment, SATA) bus, a video electronics standard association local (VESA Local Bus, VLB) bus or other suitable buses or a combination of two or more of these. Where appropriate, the bus 410 may include one or more buses. Although the embodiments of the present application describe and illustrate a specific bus, the present application considers any suitable bus or interconnection. The electronic device can execute the method for adjusting the number of container groups of a container cluster in the embodiment of the present invention, thereby implementing the above-mentioned method for adjusting the number of container groups of a container cluster.

[0151] In addition, in combination with the method for adjusting the number of container groups of a container cluster in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any method for adjusting the number of container groups of a container cluster in the above embodiment is implemented.

[0152] The present application also provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes each process of implementing any one of the above embodiments of the method for adjusting the number of container groups of a container cluster.

[0153] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0154] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (Read-Only Memory, ROM), flash memory, erasable read-only memory (Erasable ReadOnly Memory, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0155] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0156] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0157] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A method for adjusting the number of container groups in a container cluster, characterized in that: include: Obtain historical access request data that passes through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes a plurality of monitoring indicators and monitoring data of each of the monitoring indicators; Determining a pressure value of the container cluster at the target time according to the monitoring data of each of the monitoring indicators and a first preset weight; When the pressure value satisfies a preset condition, determining the number of second container groups corresponding to the pressure value according to a relationship between the preset pressure value and the preset number of container groups, the preset pressure value including the pressure value, and the preset number of container groups including the second number of container groups; When the number of the first container groups is inconsistent with the number of the second container groups, the number of the first container groups of the container cluster at the target time is adjusted to be the number of the second container groups.

2. The method for adjusting the number of container groups in a container cluster according to claim 1, characterized in that: The preset time period includes a preset number of sub-preset time periods; and determining the pressure value of the container cluster at the target time according to the monitoring data of each of the monitoring indicators and the first preset weight includes: Determine, according to the monitoring data of each of the monitoring indicators and the first preset weight, a sub-pressure value of the container cluster in each of the sub-preset time periods; The pressure value of the container cluster at the target time is determined according to the sub-pressure value of each of the sub-preset time periods and the second preset weight.

3. The method for adjusting the number of container groups in a container cluster according to claim 1, characterized in that: When the pressure value satisfies a preset condition, determining the number of second container groups corresponding to the pressure value according to the relationship between the preset pressure value and the preset number of container groups includes: When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups.

4. The method for adjusting the number of container groups in a container cluster according to claim 1, characterized in that: When the number of the first container groups is inconsistent with the number of the second container groups, after adjusting the number of the first container groups of the container cluster at the target time to the number of the second container groups, the method further includes: The container groups are scheduled according to the second container group quantity.

5. The method for adjusting the number of container groups in a container cluster according to claim 1, characterized in that: Also includes: When the number of the first container groups is the same as the number of the second container groups, the container groups are scheduled according to the number of the first container groups.

6. The method for adjusting the number of container groups in a container cluster according to claim 1, characterized in that: The multiple monitoring indicators include at least the number of requests, the request success rate and the average response time.

7. A device for adjusting the number of container groups in a container cluster, characterized in that: include: An acquisition module, configured to acquire historical access request data that passes through an access portal of a container cluster within a preset time period before a target time, and the number of first container groups of the container cluster at the target time, wherein the historical access request data includes a plurality of monitoring indicators and monitoring data of each of the monitoring indicators; A determination module, configured to determine a pressure value of the container cluster at the target time according to monitoring data of each of the monitoring indicators and a first preset weight; The determination module is further configured to determine the number of second container groups corresponding to the pressure value according to a relationship between a preset pressure value and a preset number of container groups when the pressure value satisfies a preset condition, the preset pressure value including the pressure value, and the preset number of container groups including the number of second container groups; The adjustment module is configured to adjust the first number of container groups of the container cluster at the target time to the second number of container groups when the first number of container groups is inconsistent with the second number of container groups.

8. The device for adjusting the number of container groups of a container cluster according to claim 7, characterized in that: The preset time period includes a preset number of sub-preset time periods; and the determination module is specifically configured to: Determine, according to the monitoring data of each of the monitoring indicators and the first preset weight, a sub-pressure value of the container cluster in each of the sub-preset time periods; The pressure value of the container cluster at the target time is determined according to the sub-pressure value of each of the sub-preset time periods and the second preset weight.

9. The device for adjusting the number of container groups in a container cluster according to claim 7, characterized in that: The determination module is specifically used for: When the pressure value is greater than the first threshold value, or the pressure value is less than the second threshold value, the number of second container groups corresponding to the pressure value is determined according to the relationship between the preset pressure value and the preset number of container groups.

10. The device for adjusting the number of container groups in a container cluster according to claim 7, characterized in that: The device also includes: The scheduling module is configured to, when the number of the first container groups is inconsistent with the number of the second container groups, adjust the number of the first container groups of the container cluster at the target time to be the second number of container groups, and then schedule container groups according to the second number of container groups.

11. The device for adjusting the number of container groups in a container cluster according to claim 7, characterized in that: Also includes: The scheduling module is configured to schedule container groups according to the number of the first container groups when the number of the first container groups is consistent with the number of the second container groups.

12. The device for adjusting the number of container groups in a container cluster according to claim 7, characterized in that: The multiple monitoring indicators include at least the number of requests, the request success rate and the average response time.

13. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for adjusting the number of container groups in a container cluster according to any one of claims 1 to 6 is implemented.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the method for adjusting the number of container groups in a container cluster according to any one of claims 1 to 6 is implemented.

15. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method for adjusting the number of container groups in a container cluster as described in any one of claims 1 to 6.

Citation Information

Cited By

  • Data processing method and device for vehicle production line and storage medium

    CN120723460A

  • Data processing method, device and storage medium for vehicle production line

    CN120723460B