CN115469966A - Elastic expansion method and device for container cloud service - Google Patents

Elastic expansion method and device for container cloud service Download PDF

Info

Publication number
CN115469966A
CN115469966A CN202211012480.4A CN202211012480A CN115469966A CN 115469966 A CN115469966 A CN 115469966A CN 202211012480 A CN202211012480 A CN 202211012480A CN 115469966 A CN115469966 A CN 115469966A
Authority
CN
China
Prior art keywords
index
copy number
copies
elastic
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211012480.4A
Other languages
Chinese (zh)
Inventor
宋明耀
李铁铮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Shanghu Information Technology Co ltd
Original Assignee
Shanghai Shanghu Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Shanghu Information Technology Co ltd filed Critical Shanghai Shanghu Information Technology Co ltd
Priority to CN202211012480.4A priority Critical patent/CN115469966A/en
Publication of CN115469966A publication Critical patent/CN115469966A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an elastic expansion method and an elastic expansion device for container cloud service, wherein the method comprises the following steps: collecting various index data of application in real time; aggregating the collected index data to obtain aggregated data; determining whether an index threshold alarm is triggered according to the index data and the aggregated data; if yes, determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value; and performing elastic expansion and contraction processing on the applied resources according to the target copy number. By utilizing the scheme of the invention, the flexibility of elastic expansion can be improved, and the individual requirements of different applications can be better met.

Description

Elastic expansion method and device for container cloud service
Technical Field
The invention relates to the technical field of container cloud, in particular to an elastic expansion method and device for container cloud service.
Background
The container cloud is a cloud service product implemented by deploying container services on cluster servers, and can be regarded as a lightweight Linux cloud server. The container cloud can select configuration and network as required, can be used as a virtual host, a cloud server and a cluster server, and is suitable for building stations, running application programs, configuring load balance and building service clusters. The user need not handle the maintenance work of complicated bottom layer server, only need install the mirror image that provides, can operate the container. The minimum basic unit of the container cloud is a container, the container contains all codes required by application components, a dependent environment and the like, and a user can flexibly call resources by calling a command.
Elastic scaling is a technique for automatically increasing or decreasing business resources by setting scaling rules and policies according to the business requirements of users. When the service demand is increased, the elastic expansion automatically increases the instances to ensure the computing capacity and the normal operation of the service; when the business requirement is reduced, the elastic expansion automatically reduces the examples to save the cost. Currently, to achieve elastic expansion and contraction in a container cloud, most kubernets (an open source application for managing containerization on a plurality of hosts in a cloud platform) official HPA (Horizontal Pod automation expansion) scheme is adopted, but the scheme has the problems of single index and inflexible expansion mode, and cannot meet personalized requirements of different applications.
Disclosure of Invention
The embodiment of the application provides an elastic expansion method and device for container cloud service, so that the flexibility of elastic expansion is improved, and the individual requirements of different applications are met.
Therefore, the embodiment of the invention provides the following technical scheme:
in one aspect, an embodiment of the present invention provides an elastic scaling method for a container cloud service, where the method includes:
collecting various index data of application in real time;
aggregating the collected index data to obtain aggregated data;
determining whether an index threshold alarm is triggered according to the index data and the aggregated data;
if yes, determining the target copy number of the alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value;
and performing elastic expansion and contraction processing on the applied resources according to the target copy number.
Optionally, the collecting multiple index data of the application in real time includes: acquiring common component index data of an application in real time; and/or collecting service component index data of the application in real time.
Optionally, the common component indicator data comprises any one or more of: CPU usage, CPU limit, current copy number; the business component indicator data comprises any one or more of: whether the service is online, the length of the service queue, and whether the service work thread is busy.
Optionally, the aggregating the index data to obtain aggregated data includes: performing instantaneous index aggregation and/or interval index aggregation on the index data; the instantaneous index aggregation is to calculate two or more index data at a specified moment to obtain new index data; the interval index aggregation means that statistical index data of corresponding indexes in a latest period of time are determined according to the index data and/or the new index data in a certain period of time.
Optionally, the determining whether to trigger an index threshold alarm according to the index data and the aggregated data includes: judging whether the value of an index exceeds a corresponding index threshold value or not according to the index data and the aggregated data; and if so, triggering an index threshold alarm.
Optionally, the determining, according to the value of the alarm indicator and the current copy number of the application, the target copy number of the alarm indicator includes: for each alarm index, calculating the target copy number of the alarm index according to any one of the following formulas:
target number of copies = rounding up [ current number of copies x (current index/desired index) ];
target number of copies = large value (lowest number of copies of elastic scalping, current number of copies-number of single scalped copies).
Optionally, the determining the target number of copies of the alarm indicator according to the value of the alarm indicator and the current number of copies of the application further includes: and correcting the target copy number according to the applied copy number threshold.
Optionally, the method further comprises: before the target copy number is corrected according to the applied copy number threshold, determining whether a capacity expansion copy difference is in a tolerance range according to the target copy number, wherein the capacity expansion copy difference = | the target copy number-the current copy number |; if the difference of the expansion and contraction capacity copies corresponding to all the alarm indexes is in the tolerance range, the elastic expansion and contraction processing flow is terminated.
Optionally, the copy number threshold includes: a maximum number of copies and a minimum number of copies; the correcting the target copy number according to the applied copy number threshold comprises: if the target copy number is larger than the maximum copy number, taking the maximum copy number as the target copy number of the alarm index; and if the target copy number is smaller than the minimum copy number, taking the minimum copy number as the target copy number of the alarm index.
Optionally, the performing, according to the target number of copies, elastic scaling processing on the applied resource includes: if the target copy number of any alarm index is greater than the current copy number, performing elastic expansion processing; and if the target copy number of all the set capacity reduction indexes is smaller than the current copy number, performing elastic capacity reduction treatment, wherein the capacity reduction indexes comprise one or more indexes.
Optionally, the performing elastic volume reduction processing includes: determining the number of the capacity reduction target copies; and performing elastic capacity reduction treatment according to the number of the capacity reduction target copies.
Optionally, the determining the number of the capacity reduction target copies includes: and taking the maximum value of the target copy numbers of all the capacity reduction indexes as the capacity reduction target copy number.
Optionally, the method further comprises: recording the elastic expansion processing result information each time; before elastic volume reduction processing, determining whether elastic expansion processing is performed on the application within a set time period according to recorded elastic expansion processing result information; if yes, the elastic volume reduction processing flow is terminated.
Optionally, the method further comprises:
presetting an elastic stretching strategy, wherein elastic stretching cooling time corresponding to each application is set in the elastic stretching strategy;
before determining the target copy number of each alarm index, checking the state of the application and an elastic expansion strategy associated with the application;
and if the application is in a running stop state or is currently in the elastic expansion cooling time, terminating the elastic expansion processing flow.
Optionally, the elastic expansion cooling time is the same or different for different applications.
Optionally, a global switch and sub-switches corresponding to the applications are further provided in the elastic telescoping strategy; the method further comprises the following steps: before determining the target copy number of each alarm index, checking whether the global switch and the corresponding sub-switch of the application are opened or not; if not, the elastic expansion processing flow is terminated.
On the other hand, an embodiment of the present invention further provides an elastic expansion device for a container cloud service, where the device includes: the system comprises a data acquisition module, a server, an elastic telescopic control module and a telescopic processing module; the server comprises an aggregation processing module and an alarm module;
the data acquisition module is used for acquiring various index data of application in real time and storing the index data into the server;
the aggregation processing module is used for aggregating the index data acquired by the data acquisition module to obtain aggregated data;
the alarm module is used for determining whether an index threshold alarm is triggered or not according to the index data and the aggregation data; if yes, triggering the elastic expansion control module to enter the elastic expansion processing flow;
the elastic expansion control module is used for determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value; calling the telescopic processing module to perform elastic telescopic processing according to the target copy number of each alarm index;
and the telescopic processing module is used for performing elastic telescopic processing on the applied resources.
Optionally, the data acquisition module comprises:
the first acquisition unit is used for acquiring common component index data of the application in real time; and/or
And the second acquisition unit is used for acquiring the service component index data of the application in real time.
Optionally, the aggregation processing module includes: a first polymerization unit, and/or a second polymerization unit;
the first aggregation unit is used for performing instantaneous index aggregation on the index data, wherein the instantaneous index aggregation is to calculate two or more index data at a specified moment to obtain new index data;
the second aggregation unit is configured to perform interval index aggregation on the index data, where the interval index aggregation is to determine statistical index data of a corresponding index in a recent period of time according to the index data and/or the new index data in a certain period of time.
Optionally, the elastic expansion control module comprises:
the calculating unit is used for calculating the target copy number of each alarm index according to any one of the following formulas:
target number of copies = rounding up [ current number of copies x (current index/desired index) ];
target number of copies = large value (lowest number of copies of elastic scalping, current number of copies-number of single scalping copies);
and the interface calling unit is used for calling the flexible processing module to perform elastic flexible processing according to the target copy number.
Optionally, the elastic expansion control module further comprises: and the correcting unit is used for correcting the target copy number according to the applied copy number threshold.
Optionally, the elastic expansion control module further comprises: a judging unit, configured to determine whether a difference between scaled-up and scaled-down copies is within a tolerance range according to the target number of copies before the correcting unit corrects the target number of copies according to the applied copy number threshold, where the difference between scaled-up and scaled-down copies = | the target number of copies-the current number of copies |; if the difference of the expansion and contraction volume copies corresponding to all the alarm indexes is within the tolerance range, triggering the elastic expansion control module to terminate the elastic expansion processing flow; otherwise, triggering the interface calling unit to call the telescopic processing module.
Optionally, the copy number threshold includes: a maximum number of copies and a minimum number of copies; the correcting unit is specifically configured to, if the target number of copies is greater than the maximum number of copies, use the maximum number of copies as the target number of copies of the alarm indicator; and if the target copy number is smaller than the minimum copy number, taking the minimum copy number as the target copy number of the alarm index.
Optionally, the determining unit triggers the interface calling unit to call the flexible processing module to perform elastic capacity expansion processing when the target number of copies of any alarm indicator is greater than the current number of copies; and under the condition that the target copy number of all set capacity reduction indexes is smaller than the current copy number, triggering the interface calling unit to call the flexible processing module to perform elastic capacity reduction processing, wherein the capacity reduction indexes comprise one or more indexes in the multiple indexes.
Optionally, the calculating unit is further configured to determine the number of the capacity reduction target copies; and the interface calling unit calls the flexible processing module to perform elastic capacity reduction processing according to the number of the capacity reduction target copies.
Optionally, the elastic expansion control module further comprises: the recording unit is used for recording the information of each elastic expansion processing result; the judging unit is further configured to determine whether the application has undergone elastic stretching processing within a set time period according to the elastic stretching processing result information recorded by the recording unit before triggering the interface calling unit to call the stretching processing module to perform elastic stretching processing; if yes, triggering the elastic expansion control module to terminate the elastic volume reduction processing flow.
Optionally, the apparatus further comprises: the device comprises a setting module, a control module and a control module, wherein the setting module is used for presetting an elastic expansion strategy, and the elastic expansion strategy is provided with elastic expansion cooling time corresponding to each application; the judging unit is further configured to check the state of the application and the elastic scaling strategy associated with the application before the calculating unit determines the target number of copies of each alarm indicator; and if the application is in a running stop state or is currently in the elastic expansion cooling time, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
Optionally, a global switch and sub-switches corresponding to the applications are further provided in the elastic stretching strategy; the judging unit is further configured to check whether the global switch and the corresponding sub-switch are turned on before determining the target copy number of each alarm indicator; if not, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
In another aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the foregoing method steps.
On the other hand, the elastic expansion device for the container cloud service further includes a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor executes the computer program to perform the steps of the foregoing method.
According to the elastic expansion method and device for the container cloud service, provided by the embodiment of the invention, the aggregation data, namely the new finger data, is obtained by collecting various applied index data and performing aggregation processing on the index data, so that the diversity of indexes for elastic expansion can be enriched, and the subsequent judgment on whether the elastic expansion processing is performed on the applied resources can be more accurate. And different index data can be collected for different applications, under the condition of triggering index threshold value alarm, the corresponding target copy number of each alarm index is respectively calculated for each alarm index, and the target copy number of each alarm index is comprehensively considered to carry out elastic expansion processing on the resources of the applications, so that the flexibility of elastic expansion can be greatly improved, and the individual requirements of different applications can be better met.
Furthermore, when the target copy number of each index is determined, different algorithms can be provided, and different application scenes can be better adapted.
Further, different judgment logics are adopted according to different characteristics of capacity expansion and capacity reduction, and specifically, if the number of target copies of any alarm index is larger than the current number of copies, elastic capacity expansion processing is performed; and if the target copy number of all the set capacity reduction indexes is smaller than the current copy number, performing elastic capacity reduction processing. And the volume reduction index can be set according to different applications, and can comprise one or more indexes, so that the elastic volume reduction processing is more reasonable.
Furthermore, by setting the elastic expansion strategy corresponding to each application, a global default configuration is provided so as to reduce the complexity of the application during configuration, and meanwhile, each application is allowed to have a custom configuration.
Further, before elastic capacity reduction processing is carried out on a certain application, whether the application is subjected to elastic capacity reduction processing in a set time period is determined according to the recorded elastic capacity reduction processing result information, and if yes, the elastic capacity reduction processing flow is terminated, so that the influence of frequent elastic capacity reduction processing on the application service efficiency is avoided.
Drawings
FIG. 1 is a schematic diagram of the elastic expansion and contraction of a conventional Kubernets HPA in a container cloud;
FIG. 2 is a flowchart of a method for elastic scaling of a container cloud service according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating the operation of collecting indicator data by using a Promethemostomerator indicator collecting tool according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the operation of the indicator exposure side bin in the Promatheuse operator indicator collection tool shown in FIG. 3;
FIG. 5 is a schematic diagram of an embodiment of the present invention, in which a Prometous system is used to push alarm information to an elastic expansion control center;
FIG. 6 is a schematic diagram illustrating elastic expansion and contraction processing implemented by invoking a Kubernets interface according to an embodiment of the present invention;
FIG. 7 is another flowchart of a method for elastic scaling of a container cloud service according to an embodiment of the present invention;
FIG. 8 is a control flow chart of the elastic expansion control center according to the embodiment of the present invention;
FIG. 9 is a schematic structural diagram of an elastic telescopic device of a container cloud service according to an embodiment of the present invention;
fig. 10 is another schematic structural diagram of an elastic telescopic device of a container cloud service according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention more comprehensible, embodiments accompanying figures are described in detail below.
First, a brief description will be given of the elastic scaling technique of the existing container cloud service.
Fig. 1 is a schematic diagram of elastic expansion and contraction of kubernets HPA in a container cloud.
The core component of the kubernets HPA solution is a horizontal auto-scaling controller in a kube-controller-manager (kube control manager), whose elastic scaling process is as follows:
(1) Index acquisition
The method comprises the steps that a horizontal automatic scaling controller in a kube control manager obtains indexes through an index aggregation layer located in a kube-api Server, and the index aggregation layer obtains the indexes from all containers through a metros Server-kube-cAdvisor path and conducts aggregation. Wherein:
the Metrics Server is an aggregator for monitoring data of a Kubernets cluster core, and can acquire Metrics data in a Metrics API form;
the Kubelet is a proxy component on the kubernets working node and runs on each node;
cAdvisor is a tool used to analyze the resource usage and performance characteristics of running containers.
The types of elastic expansion indexes which can be acquired in this way are limited, and only one elastic expansion index is usually obtained, namely the CPU utilization rate, which is far from enough for complex service scenes. If the index type needs to be expanded, a user-defined index interface or an external index interface needs to be realized, so that the deployment is complex and the learning cost is high.
(2) Target copy number calculation
The horizontal automatic telescoping controller calculates the target copy number based on the following algorithm, and the value of each parameter is obtained through a horizontal automatic telescoping strategy:
expected number of copies = round [ current number of copies x (current index/expected index) ];
the algorithm is a fixed algorithm and cannot be changed.
(3) To perform expansion and contraction
After the horizontal automatic telescoping controller obtains the target copy number through the calculation, the Deployment of the Deployment is performed, and the Deployment controls the number of the Pod in a manner of managing ReplicaSet. Wherein:
a Pod is the smallest deployable computing unit created and managed in kubernets, and a Pod consists of one or more containers, all of which share the network and storage within the same Pod.
ReplicaSet is a workload resource in Kubernetes that maintains a stable set of Pod copies that are running at any time. It is therefore typically used to guarantee the availability of a given number of identical pods.
The Deployment is a workload resource in Kubernetes, is a definition of pods and replicase, and defines the definition and implementation mode of the pods and the replicase.
The existing scheme for realizing elastic expansion and contraction of Kubernetes HPA in container cloud mainly has the following problems:
1. the scaling algorithm is not flexible enough: the algorithm for calculating the scaling proportion of the Kubernetes HPA is single and cannot adapt to all application scenes.
2. The core configuration is globally effective, and does not support self-definition according to service application: the requirements for the elastic stretch response time may vary from application to application, with some applications expecting a response of 5s and some applications 30s being sufficient. The Kubernetes HPA scheme can only configure global boot-point-autoscaler-sync-period on response time control, and cannot provide application-level customization. The jitter tolerance of each application to the workload is also different, and the Kubernets HPA can only be configured globally through a horizontal-pod-autoscaler-topology in the startup parameters, and cannot provide application-level customization.
3. Default index types are insufficient, and expansion is troublesome: under the default condition, only one index which can be acquired by the horizontal automatic telescopic controller and can be used for elastic telescopic action is as follows: CPU usage, which is far from sufficient for complex application scenarios.
4. The requirements for the version of Kubernetes are too high.
5. The resource utilization rate is unreasonable in calculation mode: when the kubernets HPA calculates the utilization of resources such as CPU and memory, the divisor uses the value of Requests field in Pod, and the utilization calculated in this way may exceed 100%, which is not desirable.
In order to solve the above problems, embodiments of the present invention provide an elastic stretching method and apparatus for a container cloud service, where multiple types of applied index data are collected and aggregated to obtain aggregated data, that is, new index data. Under the condition of triggering index threshold value alarm, aiming at each alarm index, respectively calculating the corresponding target copy number, and comprehensively considering the target copy number of each alarm index to carry out elastic expansion processing on the applied resource.
As shown in fig. 2, it is a flowchart of an elastic scaling method of a container cloud service according to an embodiment of the present invention, including the following steps:
step 201, collecting multiple index data of application in real time.
In the embodiment of the present invention, the common component index data and/or the service component index data of the application may be collected respectively. Wherein the common component indicator data may include, but is not limited to, any one or more of: CPU usage, CPU limit, current copy number, etc.; the business component metrics data can include, but is not limited to, any one or more of: whether the service is online, the length of the service queue, whether the service worker thread is busy, etc.
It should be noted that the common component index data may be index data related to a plurality of different applications, and the business component index data is index data for one application. In the case where a flexible scaling service needs to be provided for a plurality of different applications, it is necessary to collect, for each application, business component index data for the application. Of course, the types of the index data that can be collected may be different for different applications, and may be specifically determined according to the service characteristics of each application, and the embodiment of the present invention is not limited thereto.
In addition, it should be noted that the collected various index data are time series data, and the collected various index data can be stored in a time series database for the convenience of using the index data subsequently.
In practical application, the collection of the index data can be realized by using some existing data collection tools. For example, an Operator index acquisition tool (e.g., prometheus, which is an open source system monitoring and warning system) may be selected to acquire index data.
Fig. 3 is a schematic diagram illustrating the operation of collecting the indicator data by using a prometheusso operator indicator collecting tool in the embodiment of the present invention. Wherein:
the Prometheus server is a core part in the Prometheus assembly and is responsible for acquiring, storing and inquiring monitoring data. The Prometheus server can manage the monitoring targets through static configuration, and can also dynamically manage the monitoring targets in a Service Discovery mode in a matching mode, and acquire data from the monitoring targets.
The Prometheus Operator deploys and manages the Prometheus server according to the custom resources, and monitors the change of the custom resource events to perform corresponding processing, so that the Prometheus Operator is a control center of the whole system.
Specifically, the Prometheus Operator uses CRD (custom resource) type ServiceMonitor to describe information of the monitored object, and acquires the required index data through a link of ServiceMonitor → Service (kubernets internal resource, which defines a set of logical set and access policy of Pod) → common component/application Pod. After the index data are acquired, the Prometheus Operator stores the index data in a Prometheus server for management.
After the Prometous Operator is deployed and debugged, monitoring of some public components, such as kubelet and core (DNS) services, is started through configuration, and components, such as node-exporter, can be created at the same time to monitor the state of each node and collect index data of the node. Monitoring of these common components may collect metrics such as CPU usage, CPU limits, current copy number, etc.
For the collection of the service component indexes, an index exposure side bin (export side bin) can be added in each service Pod to expose the index data of each application meeting the Prometheus specification. The metric exposure side bin may collect business component metric data such as whether a service is online, the length of a service queue, whether a service worker thread is busy, and the like.
The working process of the index exposure side bin is as shown in fig. 4, and the main service container opens a local port in a network namespace inside the Pod to expose various index data of the service. However, the format of the metrics exposed here varies from service framework to service framework and is not generally the format required by Prometheus. Therefore, the index exposure side bin pulls the index data in a non-Prometous format from the local port opened by the main Service, and after the index data is converted into the index data in the Prometous format, the external port is opened, and the Service component exposes the index data.
The function of the index exposure side bin mainly comprises the following two points:
1) The method comprises the steps of being compatible with index formats of various main service frameworks, and converting obtained index data of various main service frameworks into unified index data in a Prometheus format;
2) Index data useless for elastic expansion and contraction are discarded and are not exposed any more, so that the storage space of the database is saved.
It should be noted that, in practical application, other index collection tools may also be used to complete collection of multiple kinds of index data, and the embodiment of the present invention is not limited thereto.
And 202, aggregating the acquired index data to obtain aggregated data.
In the embodiment of the invention, according to the characteristics of each index, instantaneous index aggregation and/or interval index aggregation can be performed on the index data, and the aggregated data, which is the aggregated result, can be used as new index data. Wherein:
the instantaneous index aggregation is to calculate two or more index data at a specified time to obtain a new index data. For example, the service availability index can be obtained by dividing the two indexes of whether the service is on-line and the current number of copies; the CPU utilization index can be obtained by dividing the two indexes of the CPU utilization amount and the CPU limitation amount; the service queue length and the service working thread data are divided to obtain an average queue length index of the service; the busy rate index of the service working threads can be obtained by dividing the two indexes of the number of the service working threads in the busy state and the total number of the service working threads.
The interval index aggregation means that statistical index data of corresponding indexes in a recent period of time are determined according to the index data and/or the new index data in a certain period of time. For example, the maximum service work thread busy rate of the service for nearly 24 hours is calculated according to the service work thread busy rate index for nearly 24 hours; calculating the minimum service availability within the service time of 5 minutes according to the service availability index of 5 minutes; calculating the maximum value of the average queue length of the service in the last 1 minute according to the average queue length index of the service in the last 1 minute; the average CPU usage for approximately 12 hours, etc. is calculated based on the CPU usage index for approximately 12 hours.
Step 203, determining whether to trigger an index threshold alarm according to the index data and the aggregation data. If yes, go to step 204; otherwise, step 202 is performed.
Specifically, it may be determined whether a value of an index exceeds a corresponding index threshold according to the index data and the aggregated data (including the new index data and the statistical index data); if yes, triggering an index threshold alarm. For example, when a Prometheus system is used to collect index data, the alert information may be pushed to the elastic expansion control center through the alert manager component, as shown in fig. 5.
It should be noted that different application may be provided with different index threshold values, and the number and types of the indexes that need to be determined by different applications whether to exceed the index threshold values may also be different, and the embodiment of the present invention is not limited thereto.
For example, for an application, it is necessary to determine whether the maximum value of the average queue length for service for approximately 1 minute exceeds 0.5, and whether the maximum service thread busy rate for approximately 24 hours is below 0.2.
It should be noted that the acquisition of the index data, the aggregation processing, and the judgment of triggering the index threshold alarm are performed independently and synchronously, that is, the index data acquired in real time is stored in the time sequence database, and the corresponding aggregation processing functional component or the server extracts the index from the time sequence database to perform aggregation processing.
And 204, determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application.
The alarm index is an index of which the value exceeds a corresponding index threshold value, and the value of the alarm index is index data or aggregated data of the corresponding alarm index.
When calculating the number of target copies of the alarm indicator, different calculation formulas may be used, for example, the number of target copies of the alarm indicator may be calculated according to any one of the following formulas:
(1) Target number of copies = rounding up [ current number of copies x (current index/desired index) ];
(2) Target number of copies = large value (lowest number of copies of elastic scalping, current number of copies-number of single scalped copies).
It should be noted that, in practical application, a set algorithm formula may be built in, or a calculation logic may be customized by a code manner, which is not limited to this embodiment of the present invention.
Further, in a non-limiting embodiment, a copy threshold corresponding to each application may be set for each application, and accordingly, the calculated target copy number may be modified according to the copy number threshold of the application, so that the finally determined target copy is within the set copy threshold.
For example, the copy number threshold may include: a maximum number of copies and a minimum number of copies. Accordingly, the modification of the target copy number according to the following principle includes:
if the target copy number is larger than the maximum copy number, taking the maximum copy number as the target copy number of the alarm index;
if the target number of copies is smaller than the minimum number of copies, taking the minimum number of copies as the target number of copies of the alarm index;
otherwise, keeping the number of the target copies of the alarm index unchanged, namely, not modifying the calculated number of the target copies.
Further, in another non-limiting embodiment, before correcting the target number of copies according to the applied copy number threshold, determining whether a difference between scaled-scaled copies is within a tolerance range according to the target number of copies, the difference between scaled-scaled copies = | target number of copies-current number of copies |; and if the difference of the expansion and contraction volume copies corresponding to all the alarm indexes is within the tolerance range, terminating the elastic expansion and contraction processing flow. By calculating the difference of the expansion and contraction capacity copies, the frequency of expansion and contraction capacity can be effectively reduced, and the requirement of application on resources and the working efficiency are better considered.
And step 205, performing elastic expansion and contraction processing on the applied resources according to the target copy number.
The step of calculating the target number of copies may be completed by the elastic expansion control center, and after the target number of copies is calculated, the elastic expansion control center may call an existing service interface to complete the elastic expansion processing.
For example, as shown in fig. 6, the elastic expansion control center may implement the elastic expansion processing by calling a kubernets interface.
In general, kubernets use a deplyme controller to manage a repliaset, which is in charge of managing Pod objects, instead of directly using a repliaset (copy set). The ReplicaSet manages all containers with tags matching a Selector, namely Pod, through a tag Selector (Label-Selector).
Of course, the embodiment of the present invention is not limited to using kubernets to complete the elastic expansion and contraction process, and any system with corresponding functions may be used.
In practical application, different judgment logics can be adopted according to different characteristics of capacity expansion and capacity reduction, for example, if the number of target copies of any alarm index is greater than the current number of copies, elastic capacity expansion processing is performed; and if the target copy number of all the set capacity reduction indexes is smaller than the current copy number, performing elastic capacity reduction processing, wherein the capacity reduction indexes may include one or more indexes, and the capacity reduction indexes may be set according to different applications, that is, different applications may correspond to different capacity reduction indexes.
Further, based on the above determination logic, for an application, if there are multiple capacity reduction indexes, it is necessary that the target copy numbers of the capacity reduction indexes are all smaller than the current copy number, and then the elastic capacity reduction processing is performed. However, the target copy numbers corresponding to different capacity reduction indexes may be different, and therefore, the number of capacity reduction target copies also needs to be determined, for example, a maximum value among the target copy numbers of all the capacity reduction indexes may be used as the number of capacity reduction target copies, and elastic capacity reduction processing may be performed according to the number of capacity reduction target copies.
Further, in a non-limiting embodiment, information of the result of each elastic expansion and contraction process may also be recorded, where the information of the result of each elastic expansion and contraction process mainly includes the time of the elastic expansion and contraction process and the current number of copies, and may also include other related information. For example, the information of the elastic expansion processing result can be recorded in MySQL (a relational database) and Redis (a non-relational database), which is convenient for query and can be used as the judgment basis for next elastic expansion. Further, the elastic expansion and contraction result can be notified through enterprise WeChat and/or electronic mail and sent to related personnel.
Correspondingly, before elastic volume reduction processing, determining whether elastic expansion processing occurs to the application within a set time period according to the recorded elastic expansion processing result information; if yes, the elastic volume reduction processing flow is terminated.
It should be noted that, the sequence numbers of the steps in the flowchart shown in fig. 1 only indicate the transmission order of the data, and do not strictly represent the time sequence of the processing of the steps. Moreover, the different steps described above may be performed independently by different components or modules.
According to the elastic expansion method of the container cloud service, provided by the embodiment of the invention, the aggregation data, namely the new index data, is obtained by collecting various applied index data and aggregating the index data, so that the diversity of indexes for elastic expansion can be enriched, and the subsequent judgment on whether the applied resources are subjected to elastic expansion processing can be more accurate. And different index data can be collected aiming at different applications, under the condition of triggering index threshold value alarm, the corresponding target copy number of each alarm index is respectively calculated aiming at each alarm index, and the target copy number of each alarm index is comprehensively considered to carry out elastic expansion processing on the resources of the applications, so that the flexibility of elastic expansion can be greatly improved, and the individual requirements of different applications can be better met.
Fig. 7 is another flowchart of an elastic scaling method of a container cloud service according to an embodiment of the present invention, including the following steps:
and 701, collecting multiple applied index data in real time.
And step 702, aggregating the acquired index data to obtain aggregated data.
And 703, determining whether to trigger an index threshold alarm or not according to the index data and the aggregated data. If so, go to step 704; otherwise, step 702 is performed.
Step 704, determining whether to terminate the elastic expansion processing flow according to the application state and the elastic expansion strategy associated with the application. If yes, go to step 705; otherwise, step 702 is performed.
The elastic expansion strategy can be preset, and different elastic expansion strategies can be set corresponding to different applications.
In one non-limiting embodiment, the elastically telescopic strategy may be provided with elastically telescopic cooling times corresponding to each application. Accordingly, in step 704, if the application is currently in a stop state or currently within the elastic expansion cooling time, it is determined to terminate the elastic expansion processing flow.
Through the setting of the elastic expansion cooling time, the influence caused by the delay of the previous elastic expansion index change can be eliminated.
Further, in another non-limiting embodiment, a global switch and a sub-switch corresponding to each application may be further disposed in the elastic scaling strategy. Accordingly, in step 704, it is further required to check whether the global switch and the sub-switch corresponding to the application are turned on; if not, determining to terminate the elastic expansion processing flow.
It should be noted that, the above-mentioned checking sequence of the application state and the elastic scaling policy associated with the application is not limited in the embodiments of the present invention. In addition, when there are a plurality of the elastic expansion/contraction policies, the order of examination for each policy is not limited.
Step 705, determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application.
And 706, performing elastic expansion and contraction processing on the applied resources according to the target copy number.
According to the elastic expansion method of the container cloud service, provided by the embodiment of the invention, through setting the elastic expansion strategy corresponding to each application, the global default configuration is provided, so that the complexity of the application during configuration is reduced, meanwhile, each application is allowed to have self-defined configuration, and different requirements of different applications on elastic expansion scenes can be better met through configuration in various forms, such as corresponding to a sub-switch, elastic expansion cooling time and the like of each application.
It should be noted that the control of the elastic expansion and contraction process may be performed by an elastic expansion and contraction control center, and fig. 8 shows a control flow of the elastic expansion and contraction control center in the embodiment of the present invention.
Referring to fig. 8, in the process, the elastic expansion control center sequentially checks the application states; if the application is in operation, continuously checking whether an associated elastic scaling strategy exists; if yes, continuously checking whether the temperature is within the cooling time; if the time is not within the cooling time, a target copy number (1) is calculated, wherein the target copy number (1) refers to the target copy number of the alarm index calculated according to the set algorithm formula in the previous step 204.
Then, the global master switch elastically scaled and the sub-switches of the application are checked. When both the main switch and the sub-switch are turned on, a target number of copies (2) is calculated based on the maximum and minimum numbers of copies corresponding to the application, and the target number of copies (2) is the target number of copies obtained by correcting the target number of copies calculated according to the set algorithm formula in the previous step 204.
Then, judging whether the copy difference of the expansion and contraction capacity is in a tolerance range according to the target copy number (1); if not, continuously judging whether the target copy number (2) is consistent with the current copy number or not. And judging whether the capacity is expanded or reduced according to the target copy number (2) and the current copy number.
Different judgment logics can be set for capacity expansion and capacity reduction, so that capacity expansion processing is carried out according to the capacity expansion logics, and capacity reduction processing is carried out according to the capacity reduction logics.
Further, when performing capacity reduction processing, it is necessary to store each capacity reduction index and the target copy number corresponding to the capacity reduction index, and also to determine whether capacity reduction and capacity expansion occur within a specified time period (the capacity reduction and capacity expansion may be manual capacity reduction or automatic capacity reduction); if not, checking whether other capacity reduction indexes all require capacity reduction. If yes, taking the maximum value of the target copy numbers of all the capacity reduction indexes as the capacity reduction target copy number, and carrying out capacity reduction processing according to the capacity reduction target copy number.
It should be noted that the flow shown in fig. 8 is only an example of a control logic, and in practical applications, the order of the above determination steps may also be different, so that the embodiment of the present invention is not limited.
Correspondingly, an embodiment of the present invention further provides an elastic expansion device for a container cloud service, as shown in fig. 9, which is a schematic structural diagram of the device.
In this embodiment, the elastic expansion device of the container cloud service includes the following modules:
a data acquisition module 901, a server 902, an elastic expansion control module 903, and an expansion processing module 904. The server 902 includes an aggregation processing module 921 and an alarm module 922.
The data acquisition module 901 is configured to acquire multiple types of index data of an application in real time and store the index data in the server;
the aggregation processing module 921 is configured to aggregate the index data acquired by the data acquisition module 901 to obtain aggregated data;
the alarm module 922 is configured to determine whether to trigger an index threshold alarm according to the index data and the aggregated data; if yes, triggering the elastic expansion control module to enter the elastic expansion processing flow;
the elastic expansion control module 903 is used for determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value; calling the telescopic processing module to perform elastic telescopic processing according to the target copy number of each alarm index;
the scaling processing module 904 is configured to perform elastic scaling processing on the resource of the application.
In a specific application, the data collection module 901 may write the collected index data into the time-series database in the server 902.
In addition, the modules may be integrated on the same physical entity, or may be located on different physical entities, which does not limit the embodiment of the present invention.
In this embodiment of the present invention, the data acquisition module 901 may include: a first acquisition unit, and/or a second acquisition unit. The first acquisition unit is used for acquiring common component index data of an application in real time; the second acquisition unit is used for acquiring the service component index data of the application in real time.
In an embodiment of the present invention, the aggregation processing module may include: a first polymeric unit, and/or a second polymeric unit. The first aggregation unit is used for performing instantaneous index aggregation on the index data, wherein the instantaneous index aggregation is to calculate two or more index data at a specified time to obtain new index data; the second aggregation unit is used for carrying out interval index aggregation on the index data, and the interval index aggregation is to determine statistical index data of corresponding indexes in a recent period of time according to the index data and/or the new index data in a certain period of time. The specific polymerization method has been described in detail above, and will not be described herein again.
In one non-limiting embodiment, the elastic expansion control module 903 may comprise: the device comprises a calculation unit and an interface calling unit. Wherein:
the calculating unit is configured to determine a target copy number of each alarm indicator according to the value of the alarm indicator and the current copy number of the application, where a calculation formula of the target copy number may be a built-in set algorithm formula, or a calculation logic defined by a code manner, and the embodiment of the present invention is not limited thereto.
The interface calling unit is used for calling the flexible processing module to perform elastic flexible processing according to the target copy number.
Further, in another non-limiting embodiment, a copy threshold corresponding to each application may also be set for each application. Correspondingly, the elastic expansion control module 903 may further include: a correcting unit, configured to correct the target copy number according to the applied copy number threshold, where a specific correcting manner may refer to the description in the foregoing embodiment of the method of the present invention, and details are not described here again.
Further, in another non-limiting embodiment, the elastic expansion control module may further include: a judging unit, configured to determine whether a difference between scaled-up and scaled-down copies is within a tolerance range according to the target number of copies before the correcting unit corrects the target number of copies according to the applied copy number threshold, where the difference between scaled-up and scaled-down copies = | the target number of copies-the current number of copies |; if the difference of the expansion and contraction capacity copies corresponding to all the alarm indexes is within the tolerance range, triggering the elastic expansion control module to terminate the elastic expansion processing flow; otherwise, triggering the interface calling unit to call the telescopic processing module.
Further, in a non-limiting embodiment, the determining unit triggers the interface calling unit to call the flexible processing module to perform elastic capacity expansion processing when the target number of copies of any one of the alarm indicators is greater than the current number of copies; and under the condition that the target copy number of all set capacity reduction indexes is smaller than the current copy number, triggering the interface calling unit to call the flexible processing module to perform elastic capacity reduction processing, wherein the capacity reduction indexes comprise one or more indexes in the multiple indexes.
Further, in a non-limiting embodiment, the calculating unit is further configured to determine a reduction target copy number. Correspondingly, the interface calling unit calls the flexible processing module to perform elastic capacity reduction processing according to the number of the capacity reduction target copies.
Further, in another non-limiting embodiment, the elastic expansion control module may further include: and the recording unit is used for recording the elastic expansion processing flow information each time. Correspondingly, the judging unit is further configured to determine whether the application has undergone elastic stretching processing within a set time period according to the elastic stretching processing flow information recorded by the recording unit before triggering the interface calling unit to call the stretching processing module to perform elastic stretching processing; if yes, triggering the elastic expansion control module to terminate the elastic contraction processing flow.
Fig. 10 is a schematic structural diagram of an elastic expansion device of a container cloud service according to an embodiment of the present invention.
In this embodiment, the apparatus includes the data acquisition module 901, the server 902, the elastic expansion control module 903, and the expansion processing module 904. The elastic expansion control module 903 includes the above-mentioned calculating unit 931, the correcting unit 932, the determining unit 933, the interface calling unit 934, and the recording unit 935.
In addition, the elastic expansion device of the container cloud service of this embodiment further includes: the setting module 900 is configured to preset an elastic stretching policy, where elastic stretching cooling time corresponding to each application is set in the elastic stretching policy.
Accordingly, in this embodiment, the determining unit 933 is further configured to check the state of the application and the elastic scaling policy associated with the application before the calculating unit 931 determines the number of target copies of each alarm indicator, in addition to some of the functions described above; and if the application is in a running stop state or is currently in the elastic expansion cooling time, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
Furthermore, a global switch and sub-switches corresponding to each application can be further arranged in the elastic expansion strategy. Correspondingly, the determining unit 933 may further check whether the global switch and the sub-switches corresponding to the applications are turned on before determining the target copy number of each alarm indicator; if not, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
It should be noted that the setting module 900 may also be integrated in the server 902.
Further, in another non-limiting embodiment, the elastic telescopic device of the container cloud service of the present invention may further include: and a notification module (not shown) for sending the elastic expansion and contraction result to related personnel through enterprise WeChat and/or e-mail. Similarly, the notification module may also be integrated in the server 902.
According to the elastic expansion device for the container cloud service, provided by the embodiment of the invention, the aggregation data, namely the new index data, is obtained by collecting various applied index data and aggregating the index data, so that the diversity of indexes for elastic expansion can be enriched, and the subsequent judgment on whether the applied resources are subjected to elastic expansion processing can be more accurate. And different index data can be collected for different applications, under the condition of triggering index threshold value alarm, the corresponding target copy number of each alarm index is respectively calculated for each alarm index, and the target copy number of each alarm index is comprehensively considered to carry out elastic expansion processing on the resources of the applications, so that the flexibility of elastic expansion can be greatly improved, and the individual requirements of different applications can be better met.
Furthermore, by setting an elastic expansion strategy corresponding to each application, a global default configuration is provided so as to reduce the complexity of the application during configuration, and meanwhile, each application is allowed to have a custom configuration.
The elastic expansion method and device for the container cloud service provided by the embodiment of the invention can be applied to a Kubernets system and can adapt to various versions of the Kubernets.
In a specific implementation, each module/unit included in each apparatus and product described in the foregoing embodiments may be a software module/unit, may also be a hardware module/unit, or may also be a part of a software module/unit and a part of a hardware module/unit.
For example, for each device or product applied to or integrated into a chip, each module/unit included in the device or product may be implemented by hardware such as a circuit, or at least a part of the module/unit may be implemented by a software program running on a processor integrated within the chip, and the rest (if any) part of the module/unit may be implemented by hardware such as a circuit; for each device or product applied to or integrated with the chip module, each module/unit included in the device or product may be implemented by using hardware such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components of the chip module, or at least some of the modules/units may be implemented by using a software program running on a processor integrated within the chip module, and the rest (if any) of the modules/units may be implemented by using hardware such as a circuit; for each device and product applied to or integrated in the terminal, each module/unit included in the device and product may be implemented by using hardware such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components in the terminal, or at least part of the modules/units may be implemented by using a software program running on a processor integrated in the terminal, and the rest (if any) part of the modules/units may be implemented by using hardware such as a circuit.
An embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, and a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the method provided in the corresponding embodiment of fig. 1, fig. 7, or fig. 8.
The embodiment of the present invention further provides an elastic expansion device for container cloud service, which includes a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor executes the steps of the method provided in the embodiment corresponding to fig. 1, fig. 7, or fig. 8 when executing the computer program.
In this embodiment of the present invention, the processor may be a Central Processing Unit (CPU), and the processor may also be other general-purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will also be appreciated that the memory in the embodiments of the subject application may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. Volatile memory may be Random Access Memory (RAM) which acts as external cache memory. By way of example and not limitation, many forms of Random Access Memory (RAM) are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlronous DRAM (SLDRAM), and direct bus RAM (DR RAM).
It should be understood that the term "and/or" herein is merely one type of association relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein indicates that the former and latter associated objects are in an "or" relationship.
The "plurality" appearing in the embodiments of the present application means two or more.
The descriptions of the first, second, etc. appearing in the embodiments of the present application are only for illustrating and differentiating the objects, and do not represent the order or the particular limitation of the number of the devices in the embodiments of the present application, and do not constitute any limitation to the embodiments of the present application.
The term "connection" in the embodiment of the present application refers to various connection manners such as direct connection or indirect connection, so as to implement communication between devices, which is not limited in this embodiment of the present application.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (30)

1. A method for elastic scaling of a container cloud service, the method comprising:
collecting multiple index data of application in real time;
aggregating the collected index data to obtain aggregated data;
determining whether an index threshold alarm is triggered according to the index data and the aggregated data;
if yes, determining the target copy number of the alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value;
and performing elastic expansion and contraction processing on the applied resources according to the target copy number.
2. The method of claim 1, wherein the collecting multiple metric data for an application in real-time comprises:
acquiring common component index data of an application in real time; and/or
And acquiring the index data of the applied service components in real time.
3. The method of claim 2, wherein:
the common component indicator data comprises any one or more of: CPU usage, CPU limit, current copy number;
the business component indicator data includes any one or more of: whether the service is online, the length of the service queue, and whether the service work thread is busy.
4. The method of claim 1, wherein the aggregating the index data to obtain aggregated data comprises: performing instantaneous index aggregation and/or interval index aggregation on the index data;
the instantaneous index aggregation is to calculate two or more index data at a specified moment to obtain new index data;
the interval index aggregation means that statistical index data of corresponding indexes in a latest period of time are determined according to the index data and/or the new index data in a certain period of time.
5. The method of claim 1, wherein determining whether to trigger an indicator threshold alarm based on the indicator data and the aggregated data comprises:
judging whether the index value exceeds a corresponding index threshold value or not according to the index data and the aggregated data;
and if so, triggering an index threshold alarm.
6. The method of claim 1, wherein determining the target number of copies of the alarm indicator based on the value of the alarm indicator and the current number of copies of the application comprises:
for each alarm index, calculating the target copy number of the alarm index according to any one of the following formulas:
target number of copies = round up [ current number of copies × (current index/desired index) ];
target number of copies = large value (lowest number of copies of elastic scalping, current number of copies-number of single scalped copies).
7. The method of claim 6, wherein determining the target number of copies of the alarm indicator based on the value of the alarm indicator and the current number of copies of the application further comprises:
and correcting the target copy number according to the applied copy number threshold.
8. The method of claim 7, further comprising:
before the target copy number is corrected according to the applied copy number threshold, determining whether a capacity expansion copy difference is in a tolerance range according to the target copy number, wherein the capacity expansion copy difference = | the target copy number-the current copy number |;
and if the difference of the expansion and contraction volume copies corresponding to all the alarm indexes is within the tolerance range, terminating the elastic expansion and contraction processing flow.
9. The method of claim 7, wherein the threshold number of copies comprises: a maximum number of copies and a minimum number of copies; the correcting the target copy number according to the applied copy number threshold comprises:
if the target copy number is larger than the maximum copy number, taking the maximum copy number as the target copy number of the alarm index;
and if the target copy number is smaller than the minimum copy number, taking the minimum copy number as the target copy number of the alarm index.
10. The method of claim 9, wherein the elastically scaling the resource of the application according to the target number of copies comprises:
if the target copy number of any alarm index is larger than the current copy number, carrying out elastic capacity expansion processing;
and if the target copy number of all the set capacity reduction indexes is smaller than the current copy number, performing elastic capacity reduction treatment, wherein the capacity reduction indexes comprise one or more indexes.
11. The method of claim 10, wherein said performing elastic reduction processing comprises:
determining the number of the reduced-capacity target copies;
and performing elastic capacity reduction treatment according to the number of the capacity reduction target copies.
12. The method of claim 11, wherein determining the number of scaled target copies comprises:
and taking the maximum value of the target copy numbers of all the capacity reduction indexes as the capacity reduction target copy number.
13. The method of claim 10, further comprising:
recording the elastic expansion processing result information each time;
before elastic volume reduction processing, determining whether elastic expansion processing occurs to the application within a set time period according to recorded elastic expansion processing result information;
if yes, the elastic volume reduction processing flow is terminated.
14. The method according to any one of claims 1 to 13, further comprising:
presetting an elastic stretching strategy, wherein elastic stretching cooling time corresponding to each application is set in the elastic stretching strategy;
before determining the target copy number of each alarm index, checking the state of the application and an elastic expansion strategy associated with the application;
and if the application is in a running stop state or is currently in the elastic expansion cooling time, terminating the elastic expansion processing flow.
15. The method of claim 14, wherein the elastic stretch cooling time is the same or different for different applications.
16. The method according to claim 14, wherein a global switch and a sub-switch corresponding to each application are further provided in the elastic scaling strategy; the method further comprises the following steps:
before determining the target copy number of each alarm index, checking whether the global switch and the corresponding sub-switch of the application are opened or not;
if not, ending the elastic expansion process flow.
17. An elastic telescopic device of a container cloud service, characterized in that the device comprises: the system comprises a data acquisition module, a server, an elastic telescopic control module and a telescopic processing module; the server comprises an aggregation processing module and an alarm module;
the data acquisition module is used for acquiring various index data of application in real time and storing the index data into the server;
the aggregation processing module is used for aggregating the index data acquired by the data acquisition module to obtain aggregated data;
the alarm module is used for determining whether to trigger index threshold alarm according to the index data and the aggregation data; if yes, triggering the elastic expansion control module to enter the elastic expansion processing flow;
the elastic expansion control module is used for determining the target copy number of each alarm index according to the value of the alarm index and the current copy number of the application; the alarm index is an index of which the value exceeds a corresponding index threshold value; calling the telescopic processing module to perform elastic telescopic processing according to the target copy number of each alarm index;
and the telescopic processing module is used for performing elastic telescopic processing on the applied resources.
18. The apparatus of claim 17, wherein the data acquisition module comprises:
the first acquisition unit is used for acquiring common component index data of the application in real time; and/or
And the second acquisition unit is used for acquiring the service component index data of the application in real time.
19. The apparatus of claim 17, wherein the aggregation processing module comprises: a first polymerization unit, and/or a second polymerization unit;
the first aggregation unit is used for performing instantaneous index aggregation on the index data, wherein the instantaneous index aggregation is to calculate two or more index data at a specified moment to obtain new index data;
the second aggregation unit is configured to perform interval index aggregation on the index data, where the interval index aggregation is to determine statistical index data of a corresponding index in a recent period of time according to the index data and/or the new index data in a certain period of time.
20. The apparatus of claim 17, wherein the elastic expansion control module comprises:
the calculating unit is used for calculating the target copy number of each alarm index according to any one of the following formulas:
target number of copies = round up [ current number of copies × (current index/desired index) ];
target number of copies = large value (lowest number of copies of elastic scalping, current number of copies-number of single scalping copies);
and the interface calling unit is used for calling the telescopic processing module to perform elastic telescopic processing according to the target copy number.
21. The apparatus of claim 20, wherein the elastic expansion control module further comprises:
and the correcting unit is used for correcting the target copy number according to the applied copy number threshold.
22. The apparatus of claim 21, wherein the elastic expansion control module further comprises:
a judging unit, configured to determine whether a difference between scaled-up and scaled copies is within a tolerance range according to the target copy number before the target copy number is corrected by the correcting unit according to the applied copy number threshold, where the difference between scaled-up and scaled copies = | target copy number-current copy number |; if the difference of the expansion and contraction volume copies corresponding to all the alarm indexes is within the tolerance range, triggering the elastic expansion control module to terminate the elastic expansion processing flow; otherwise, triggering the interface calling unit to call the telescopic processing module.
23. The apparatus of claim 22, wherein the threshold number of copies comprises: a maximum number of copies and a minimum number of copies;
the correcting unit is specifically configured to, if the target number of copies is greater than the maximum number of copies, use the maximum number of copies as the target number of copies of the alarm indicator; and if the target copy number is smaller than the minimum copy number, taking the minimum copy number as the target copy number of the alarm index.
24. The apparatus of claim 22,
the judging unit triggers the interface calling unit to call the telescopic processing module to perform elastic expansion processing under the condition that the target copy number of any alarm index is greater than the current copy number; and under the condition that the target copy number of all set capacity reduction indexes is smaller than the current copy number, triggering the interface calling unit to call the flexible processing module to perform elastic capacity reduction processing, wherein the capacity reduction indexes comprise one or more indexes in the multiple indexes.
25. The apparatus of claim 24,
the calculating unit is also used for determining the number of the reduced-capacity target copies;
and the interface calling unit calls the flexible processing module to perform flexible capacity reduction processing according to the number of the capacity reduction target copies.
26. The apparatus of claim 24, wherein the elastic expansion control module further comprises:
the recording unit is used for recording the information of each elastic expansion processing result;
the judging unit is further configured to determine whether the application has undergone elastic stretching processing within a set time period according to the elastic stretching processing result information recorded by the recording unit before triggering the interface calling unit to call the stretching processing module to perform elastic stretching processing; if yes, triggering the elastic expansion control module to terminate the elastic volume reduction processing flow.
27. The apparatus of any one of claims 22 to 26, further comprising:
the device comprises a setting module, a control module and a control module, wherein the setting module is used for presetting an elastic expansion strategy, and the elastic expansion strategy is provided with elastic expansion cooling time corresponding to each application;
the judging unit is further configured to check the state of the application and the elastic expansion and contraction strategy associated with the application before the calculating unit determines the number of target copies of each alarm index; and if the application is in a running stop state or is currently in the elastic expansion cooling time, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
28. The device of claim 27, wherein a global switch and a sub-switch corresponding to each application are further disposed in the elastic expansion strategy;
the judging unit is also used for checking whether the global switch and the sub-switches corresponding to the applications are opened or not before determining the target copy number of each alarm index; if not, triggering the elastic expansion control module to terminate the elastic expansion processing flow.
29. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 16.
30. A resilient pantograph for a container cloud service, comprising a memory and a processor, the memory having stored thereon a computer program executable on the processor, wherein the processor executes the computer program to perform the steps of the method of any one of claims 1 to 16.
CN202211012480.4A 2022-08-23 2022-08-23 Elastic expansion method and device for container cloud service Pending CN115469966A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211012480.4A CN115469966A (en) 2022-08-23 2022-08-23 Elastic expansion method and device for container cloud service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211012480.4A CN115469966A (en) 2022-08-23 2022-08-23 Elastic expansion method and device for container cloud service

Publications (1)

Publication Number Publication Date
CN115469966A true CN115469966A (en) 2022-12-13

Family

ID=84366364

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211012480.4A Pending CN115469966A (en) 2022-08-23 2022-08-23 Elastic expansion method and device for container cloud service

Country Status (1)

Country Link
CN (1) CN115469966A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116599968A (en) * 2023-07-18 2023-08-15 中移(苏州)软件技术有限公司 Expansion and contraction method and device, electronic equipment and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116599968A (en) * 2023-07-18 2023-08-15 中移(苏州)软件技术有限公司 Expansion and contraction method and device, electronic equipment and readable storage medium
CN116599968B (en) * 2023-07-18 2023-11-03 中移(苏州)软件技术有限公司 Expansion and contraction method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN108683720B (en) Container cluster service configuration method and device
CN111818159B (en) Management method, device, equipment and storage medium of data processing node
WO2019169724A1 (en) Server concurrency control method and device, computer device, and storage medium
CN102546256B (en) System and method used for monitoring cloud computation service
WO2020253111A1 (en) Automatic expansion method and apparatus for blockchain node, and operation and maintenance terminal and storage medium
CN102882909B (en) Cloud computing service monitoring system and method thereof
WO2016069038A1 (en) Policy based workload scaler
CN111522636A (en) Application container adjusting method, application container adjusting system, computer readable medium and terminal device
CN103384206A (en) Concurrent processing method and system for mass data
CN112579304A (en) Resource scheduling method, device, equipment and medium based on distributed platform
CN111277640B (en) User request processing method, device, system, computer equipment and storage medium
CN112751726A (en) Data processing method and device, electronic equipment and storage medium
CN111930493A (en) NodeManager state management method and device in cluster and computing equipment
CN115469966A (en) Elastic expansion method and device for container cloud service
CN114490078A (en) Dynamic capacity reduction and expansion method, device and equipment for micro-service
CN111339466A (en) Interface management method and device, electronic equipment and readable storage medium
CN213876703U (en) Resource pool management system
CN117369941A (en) Pod scheduling method and system
CN115883330B (en) Alarm event processing method, system, equipment and storage medium
CN109510730A (en) Distributed system and its monitoring method, device, electronic equipment and storage medium
US11736562B1 (en) Method and system for achieving high availability of service under high-load scene in distributed system
CN113448747B (en) Data transmission method, device, computer equipment and storage medium
CN111885159B (en) Data acquisition method and device, electronic equipment and storage medium
CN112187543A (en) Cloud platform event monitoring system and method and electronic equipment
CN111209118A (en) Method and device for determining resource allowance, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination