CN113867957A - Method and device for realizing elastic expansion of number of cross-cluster containers - Google Patents

Method and device for realizing elastic expansion of number of cross-cluster containers Download PDF

Info

Publication number
CN113867957A
CN113867957A CN202111141780.8A CN202111141780A CN113867957A CN 113867957 A CN113867957 A CN 113867957A CN 202111141780 A CN202111141780 A CN 202111141780A CN 113867957 A CN113867957 A CN 113867957A
Authority
CN
China
Prior art keywords
telescopic
scaling
cluster
application
task
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
CN202111141780.8A
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.)
Beijing Tongchuang Yongyi Technology Development Co ltd
Original Assignee
Beijing Tongchuang Yongyi Technology Development 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 Beijing Tongchuang Yongyi Technology Development Co ltd filed Critical Beijing Tongchuang Yongyi Technology Development Co ltd
Priority to CN202111141780.8A priority Critical patent/CN113867957A/en
Publication of CN113867957A publication Critical patent/CN113867957A/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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/161Computing infrastructure, e.g. computer clusters, blade chassis or hardware partitioning

Landscapes

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

Abstract

The application provides a method and a device for realizing elastic expansion of the number of cross-cluster containers, which configure an application needing expansion and a corresponding expansion strategy by calling an API of an expansion service instance in a leader role; the method comprises the steps that a case executing the telescopic task obtains a monitoring index applied to a cluster to which the case belongs from a monitoring service, weighted average is conducted according to the number of copies, and a comprehensive index value is obtained through calculation; executing an example of a telescopic task, and calculating the reasonable copy number in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the copy number when the comprehensive index value is not in the preset telescopic threshold value interval; and executing the example of the scaling task, calling an API (application programming interface) of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster. The method and the system improve the availability of the service system and ensure that the application system always has proper capacity to meet the current flow demand under the condition of meeting the disaster tolerance requirement.

Description

Method and device for realizing elastic expansion of number of cross-cluster containers
Technical Field
The present invention relates to the field of cloud native technologies, and in particular, to a method and an apparatus for implementing elastic scaling of a number of cross-cluster containers based on a distributed architecture in a cloud native kubernets environment.
Background
With the advancement of enterprise digital transformation, cloud-native has become an important engine for driving business growth. As an industry fact standard of cloud native applications, Kubernetes (hereinafter referred to as k8s) provides an efficient unified management mechanism for containerized deployment, overall planning, and construction and upgrade of enterprise resource applications.
At present, simultaneous deployment and operation of k8s multiple clusters are unavoidable, and on one hand, a hybrid cloud or a multi-cloud architecture determines that multiple clusters are needed; on the other hand, if there is only one cluster and the cluster fails, all services are affected. However, currently, resource scheduling is limited to clusters, application availability is limited to clusters, elastic scaling is limited to clusters, and a mechanism for elastically scaling the number of containers across clusters does not exist.
Therefore, how to better improve the availability of the service system and ensure that the application system always has proper capacity to meet the current flow demand under the condition of meeting the disaster tolerance requirement.
Disclosure of Invention
In view of the above problems, the present application provides a method and an apparatus for implementing elastic scaling of the number of cross-cluster containers, so as to improve the availability of a service system and ensure that an application system always has a proper capacity to meet the current traffic demand while meeting the disaster tolerance requirement.
In order to achieve the above object, the present application provides the following technical solutions:
a method for realizing cross-cluster container quantity elastic expansion comprises the steps of initializing a plurality of expansion service instances into a plurality of k8s clusters to form a distributed cluster; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a Raft database, and the method comprises the following steps:
calling an API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
the example executing the telescopic task obtains the monitoring index applied to the cluster to which the example belongs from the monitoring service, and performs weighted average according to the number of the copies to calculate to obtain a comprehensive index value;
executing the example of the telescopic task to judge whether the comprehensive index value is within a preset telescopic threshold interval;
when the comprehensive index value is not in the preset telescopic threshold value interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies;
and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster.
Further, the calling the API of the scaling service instance in the leader role to configure the application needing scaling and the corresponding scaling policy includes:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
Further, the step of obtaining, by the instance executing the telescopic task, the monitoring index applied to the cluster to which the application belongs from the monitoring service, performing weighted average according to the number of copies, and calculating to obtain a comprehensive index value includes:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
Further, the method also comprises the following steps:
after performing a scaling, a cooling period is set for the application, and during the cooling period, no elastic scaling is performed any more, so as to avoid that the copy number fluctuates too frequently.
A cross-cluster container quantity elastic expansion realizing device initializes a plurality of expansion service instances to a plurality of k8s clusters to form a distributed cluster; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a raw database, and the device comprises:
the first processing unit is used for calling the API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
the second processing unit is used for executing the instances of the telescopic tasks to acquire the monitoring indexes applied to the cluster to which the instances belong from the monitoring service, and performing weighted average according to the number of the copies to calculate to obtain comprehensive index values;
the third processing unit is used for executing the example of the telescopic task and judging whether the comprehensive index value is within a preset telescopic threshold value interval or not;
a fourth processing unit, configured to calculate a reasonable number of copies in each cluster according to a preset weight of each cluster and a maximum value and a minimum value of the number of copies when the comprehensive index value is not within the preset scaling threshold interval;
and the fifth processing unit is used for executing the example of the scaling task, calling the API of the scaling strategy and scaling the copy number of the application to be processed in the corresponding cluster.
Further, the first processing unit is specifically configured to:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
Further, the second processing unit is specifically configured to:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
Further, the method also comprises the following steps:
and the sixth processing unit is used for setting a cooling period for the application after one expansion and contraction is performed, and in the cooling period, elastic scaling is not performed any more so as to avoid that the copy number fluctuates too frequently.
A storage medium comprising a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute the method for implementing elastic scaling across the number of cluster containers as described above.
An electronic device comprising at least one processor, and at least one memory, bus connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to call the program instructions in the memory to execute the method for implementing elastic scaling across the number of cluster containers as described above.
According to the method and the device for realizing the elastic expansion of the number of the cross-cluster containers, the application needing expansion and contraction and the corresponding expansion strategy are configured by calling the API of the expansion service instance in the leader role; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances; the example executing the telescopic task obtains the monitoring index applied to the cluster to which the example belongs from the monitoring service, and performs weighted average according to the number of the copies to calculate to obtain a comprehensive index value; executing the example of the telescopic task, and when the comprehensive index value is not in a preset telescopic threshold interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies; and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster. The method and the system improve the availability of the service system and ensure that the application system always has proper capacity to meet the current flow demand under the condition of meeting the disaster tolerance requirement.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for implementing elastic expansion and contraction of a number of cross-cluster containers according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an assembly structure disclosed in an embodiment of the present application;
fig. 3 is a schematic flow chart of a newly added scaling strategy disclosed in the embodiment of the present application;
FIG. 4 is a flow chart illustrating a change scaling strategy disclosed in an embodiment of the present application;
FIG. 5 is a schematic flow chart illustrating a delete scaling strategy according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an implementation apparatus for elastic expansion and contraction of the number of cross-cluster containers disclosed in the embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.
Detailed Description
The design idea of the method and the device for achieving elastic expansion of the number of the cross-cluster containers is derived from increasing attention of enterprises in a cloud-based transformation process aiming at important application system BIA (Business Impact Analysis) indexes in a cloud-based environment, and the simultaneous deployment and operation of multiple clusters of applications cannot be avoided. The existing elastic expansion and contraction technology of the container number is single cluster, and the elastic expansion and contraction technology of a cross cluster is lacked.
The distributed architecture based on the Raft protocol realizes the elastic expansion of the number of the cross-cluster containers, effectively improves the automation of the expansion of the number of the containers when the service system is deployed in multiple clusters, and ensures that the application system always has proper capacity to meet the current flow demand; the realization mode of the self distributed architecture also ensures the reliability of the telescopic service; meanwhile, the plurality of telescopic service instances can perform detection implementation of elastic telescopic on the application in parallel, and load balance is achieved to a certain extent.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a schematic flow chart of a method for implementing elastic expansion of a number of cross-cluster containers according to an embodiment of the present application is provided. As shown in fig. 1, an embodiment of the present application provides a method for implementing flexible scaling of a number of cross-cluster containers, and first, a plurality of scaling service instances are initialized to a plurality of k8s clusters to form a distributed cluster, as shown in fig. 2; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a raw database, and the method comprises the following steps:
s101: calling an API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances; and the example executing the telescopic task obtains the monitoring index applied to the cluster to which the application belongs from the monitoring service, performs weighted average according to the number of the copies, and calculates to obtain a comprehensive index value.
As shown in fig. 2, in the embodiment of the present application, the scaling service system uses a Raft protocol to ensure data consistency of the system. The raw is a consistency protocol belonging to a leader-follower type, there is only one leader in a cluster, all transaction requests are processed by the leader, the leader solicits the opinion of the follower, and the consensus is achieved inside the cluster to determine whether to execute the transaction. When the leader fails, the follower in the cluster selects a new leader in a voting mode, and the cluster operation is maintained.
The application comprises a name space and a deployment name, and the scaling strategy is the weight of POD copy number applied to each cluster, the minimum value and the maximum value of the copy number, and the threshold value of an application monitoring index.
It should be noted that the API of the external system calling the scaling service sets the application requiring automatic elastic scaling and the corresponding scaling policy. The instance in the Leader role is responsible for updating the configuration data, and the instance in the Follower role receives the request and forwards the request to the service in the Leader role. The instance of the Leader role updates local data and synchronizes to the instance of the Follow role by using a Raft protocol, so that the consistency of the data is ensured.
In this step, for the received application list and the corresponding scaling strategy, the scaling service instance of the Leader role determines a node for executing the scaling task of the application, and calls an API to dispatch the task to the corresponding node. And the scaling service instance of the Leader role maintains a mapping relation table between the application and the scaling service instance for executing the task and updates the mapping relation table into a Raft database.
It should be noted that the scaling service instance in the leader role is responsible for maintaining a mapping relationship table between the application and the instance executing the scaling task in the memory. The associated processing includes: when a raft protocol detects that a certain telescopic task instance exits the cluster or is in a fault state, adjusting the application responsible by the telescopic service instance to other telescopic service instances; and when the application is deleted, informing the corresponding scaling instance to stop the scaling task of the application. And regularly polling the application list responsible for each telescopic instance, and comparing the application list with the mapping table maintained in the current memory to ensure the data consistency of the mapping table.
S102: and the example executing the telescopic task obtains the monitoring index applied to the cluster to which the application belongs from the monitoring service, performs weighted average according to the number of the copies, and calculates to obtain a comprehensive index value.
In this step, the scalable service instance receiving the task dispatch acquires the average value of the monitoring index in the specified time period from the monitoring service (such as prometheus) of each cluster in which the application is deployed at regular time, and then, after acquiring the monitoring index value applied to each cluster, performs weighted average calculation according to the number of the copies and the index value to acquire the comprehensive index value of the application.
S103: and executing the stretching task to judge whether the comprehensive index value is within a preset stretching threshold interval.
S104: and when the comprehensive index value is not in the preset telescopic threshold value interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies.
In step S103 and step S104, the example executing the scaling task determines whether the above-mentioned overall index value is within the specified scaling threshold interval, if so, calculates the reasonable number of copies in each cluster according to the set weight and the minimum and maximum value of the number of copies, and executes the following step S105; if not, the next cycle is continued.
S105: and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster.
In this embodiment of the present application, when role switching occurs in a cluster, an instance implementation process for newly switching to a leader role includes: reading application expansion strategy data in a raft database; polling all the telescopic service instances in normal states to obtain an application list responsible for each instance; carrying out differential comparison on the obtained application list and an application list obtained from a database to construct a mapping table; if there is an application for which there is no scaling instance responsible, it is dispatched to the least loaded instance.
It should be noted that, as shown in fig. 3 to fig. 5, the implementation method for elastic scaling of the number of cross-cluster containers may include adding a scaling policy, changing a scaling policy, deleting a scaling policy, and the like.
S106: after performing a scaling, a cooling period is set for the application, and during the cooling period, no elastic scaling is performed any more, so as to avoid that the copy number fluctuates too frequently.
The embodiment of the application provides a method for realizing flexible expansion of the number of cross-cluster containers, which is characterized in that an application needing expansion and contraction and a corresponding expansion strategy are configured by calling an API (application programming interface) of an expansion service instance in a leader role; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances; the example executing the telescopic task obtains the monitoring index applied to the cluster to which the example belongs from the monitoring service, and performs weighted average according to the number of the copies to calculate to obtain a comprehensive index value; executing the example of the telescopic task, and when the comprehensive index value is not in a preset telescopic threshold interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies; and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster. The embodiment of the application can improve the availability of the service system and ensure that the application system always has proper capacity to meet the current flow demand under the condition of meeting the disaster tolerance requirement.
Referring to fig. 6, based on the method for implementing elastic scaling of the number of cross-cluster containers disclosed in the foregoing embodiments, this embodiment correspondingly discloses an apparatus for implementing elastic scaling of the number of cross-cluster containers, where multiple scaling service instances are initialized to multiple k8s clusters to form a distributed cluster; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a raw database, and the device comprises:
the first processing unit 601 is configured to invoke an API of a scaling service instance in a leader role to configure an application needing scaling and a corresponding scaling policy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
a second processing unit 602, configured to execute an instance of the telescopic task to obtain a monitoring index applied to a cluster to which the application belongs from a monitoring service, perform weighted average according to the number of copies, and calculate to obtain a comprehensive index value;
a third processing unit 603, configured to execute the instance of the scaling task to determine whether the composite indicator value is within a preset scaling threshold interval;
a fourth processing unit 604, configured to, when the comprehensive index value is not within the preset scaling threshold interval, calculate a reasonable number of copies in each cluster according to a preset weight of each cluster and a maximum value and a minimum value of the number of copies;
a fifth processing unit 605, configured to execute the instance of the scaling task, call an API of the scaling policy, and scale the number of copies of the application to be processed in the corresponding cluster.
Further, the first processing unit 601 is specifically configured to:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
Further, the second processing unit 602 is specifically configured to:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
Further, the apparatus further comprises:
a sixth processing unit 606, configured to set a cooling period for the application after performing one scaling, and in the cooling period, no longer perform flexible scaling, so as to avoid that the number of copies fluctuates too frequently.
The device for realizing the elastic expansion and contraction of the number of the cross-cluster containers comprises a processor and a memory, wherein the first processing unit, the second processing unit, the third processing unit, the fourth processing unit, the fifth processing unit, the sixth processing unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, the usability of the service system is improved by adjusting the kernel parameters under the condition of meeting the disaster tolerance requirement, and the application system is ensured to always have proper capacity so as to meet the current flow demand.
The embodiment of the application provides a storage medium, wherein a program is stored on the storage medium, and when the program is executed by a processor, the method for realizing the elastic expansion and contraction of the number of the cross-cluster containers is realized.
The embodiment of the application provides a processor, wherein the processor is used for running a program, and the method for implementing elastic expansion and contraction of the number of cross-cluster containers is executed when the program runs.
An embodiment of the present application provides an electronic device, as shown in fig. 7, the electronic device 70 includes at least one processor 701, and at least one memory 702 and a bus 703, which are connected to the processor; the processor 701 and the memory 702 complete communication with each other through the bus 703; the processor 701 is configured to call the program instructions in the memory 702 to execute the method for implementing the number of cross-cluster containers elastic scaling described above.
The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
calling an API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
the example executing the telescopic task obtains the monitoring index applied to the cluster to which the example belongs from the monitoring service, and performs weighted average according to the number of the copies to calculate to obtain a comprehensive index value;
executing the example of the telescopic task to judge whether the comprehensive index value is within a preset telescopic threshold interval;
when the comprehensive index value is not in the preset telescopic threshold value interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies;
and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster.
Further, the calling the API of the scaling service instance in the leader role to configure the application needing scaling and the corresponding scaling policy includes:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
Further, the step of obtaining, by the instance executing the telescopic task, the monitoring index applied to the cluster to which the application belongs from the monitoring service, performing weighted average according to the number of copies, and calculating to obtain a comprehensive index value includes:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
Further, the method also comprises the following steps:
after performing a scaling, a cooling period is set for the application, and during the cooling period, no elastic scaling is performed any more, so as to avoid that the copy number fluctuates too frequently.
The present application is described in terms of flowcharts and/or block diagrams of methods, apparatus (systems), computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for realizing elastic expansion of cross-cluster container quantity is characterized in that a plurality of expansion service instances are initialized to a plurality of k8s clusters to form a distributed cluster; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a Raft database, and the method comprises the following steps:
calling an API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
the example executing the telescopic task obtains the monitoring index applied to the cluster to which the example belongs from the monitoring service, and performs weighted average according to the number of the copies to calculate to obtain a comprehensive index value;
executing the example of the telescopic task to judge whether the comprehensive index value is within a preset telescopic threshold interval;
when the comprehensive index value is not in the preset telescopic threshold value interval, calculating the reasonable number of the copies in each cluster according to the preset weight of each cluster and the maximum value and the minimum value of the number of the copies;
and executing the example of the scaling task, calling the API of the scaling strategy, and scaling the copy number of the application to be processed in the corresponding cluster.
2. The method of claim 1, wherein the calling the API of the scaled service instance in the leader role configures the application that needs scaling and the corresponding scaling policy, comprising:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
3. The method of claim 1, wherein the step of obtaining, by the instance executing the scaling task, the monitoring index applied to the cluster to which the instance belongs from the monitoring service, performing weighted average according to the number of copies, and calculating to obtain a comprehensive index value comprises:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
4. The method of claim 1, further comprising:
after performing a scaling, a cooling period is set for the application, and during the cooling period, no elastic scaling is performed any more, so as to avoid that the copy number fluctuates too frequently.
5. A cross-cluster container quantity elastic expansion realizing device is characterized in that a plurality of expansion service instances are initialized to a plurality of k8s clusters to form a distributed cluster; the extension service instance in the leader role provides an API for a pending application list and a corresponding extension strategy to the outside; the telescopic service instance with the leader role is used for maintaining a mapping relation table between the application to be processed and the telescopic service instance for executing the task in a memory, and updating the mapping relation table into a raw database, and the device comprises:
the first processing unit is used for calling the API of the telescopic service instance in the leader role to configure an application needing to be telescopic and a corresponding telescopic strategy; the telescopic service instance of the leader role distributes telescopic tasks to other telescopic service instances;
the second processing unit is used for executing the instances of the telescopic tasks to acquire the monitoring indexes applied to the cluster to which the instances belong from the monitoring service, and performing weighted average according to the number of the copies to calculate to obtain comprehensive index values;
the third processing unit is used for executing the example of the telescopic task and judging whether the comprehensive index value is within a preset telescopic threshold value interval or not;
a fourth processing unit, configured to calculate a reasonable number of copies in each cluster according to a preset weight of each cluster and a maximum value and a minimum value of the number of copies when the comprehensive index value is not within the preset scaling threshold interval;
and the fifth processing unit is used for executing the example of the scaling task, calling the API of the scaling strategy and scaling the copy number of the application to be processed in the corresponding cluster.
6. The apparatus according to claim 5, wherein the first processing unit is specifically configured to:
and according to the preset application and the corresponding scaling strategy, the scaling service instance of the leader role determines a node for executing the scaling task of the preset application, and calls the configuration API to distribute the scaling task to the corresponding node.
7. The apparatus according to claim 5, wherein the second processing unit is specifically configured to:
and acquiring a monitoring index average value in a specified time period from the monitoring service of each cluster deployed with the application at regular time according to the telescopic service instance dispatched by the telescopic task, performing weighted average on the monitoring index value according to the number of the copies, and calculating to obtain the comprehensive index value.
8. The apparatus of claim 5, further comprising:
and the sixth processing unit is used for setting a cooling period for the application after one expansion and contraction is performed, and in the cooling period, elastic scaling is not performed any more so as to avoid that the copy number fluctuates too frequently.
9. A storage medium comprising a stored program, wherein the program, when executed, controls a device on which the storage medium is located to perform the method of implementing elastic scaling across the number of cluster containers according to any one of claims 1 to 4.
10. An electronic device comprising at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to invoke program instructions in the memory to perform the cross-cluster-container-quantity elastic-scaling implementation method of any of claims 1 to 4.
CN202111141780.8A 2021-09-28 2021-09-28 Method and device for realizing elastic expansion of number of cross-cluster containers Pending CN113867957A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111141780.8A CN113867957A (en) 2021-09-28 2021-09-28 Method and device for realizing elastic expansion of number of cross-cluster containers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111141780.8A CN113867957A (en) 2021-09-28 2021-09-28 Method and device for realizing elastic expansion of number of cross-cluster containers

Publications (1)

Publication Number Publication Date
CN113867957A true CN113867957A (en) 2021-12-31

Family

ID=78991750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111141780.8A Pending CN113867957A (en) 2021-09-28 2021-09-28 Method and device for realizing elastic expansion of number of cross-cluster containers

Country Status (1)

Country Link
CN (1) CN113867957A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666215A (en) * 2022-03-15 2022-06-24 上海道客网络科技有限公司 Method, system, medium and electronic device for cross-cluster elastic expansion and contraction of application
CN115361281A (en) * 2022-08-19 2022-11-18 浙江极氪智能科技有限公司 Processing method, device, equipment and medium for capacity expansion of multiple cloud cluster nodes
CN115361385A (en) * 2022-08-15 2022-11-18 山东体育学院 Cloud native application automatic elastic expansion system and expansion method in Docker Swarm environment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666215A (en) * 2022-03-15 2022-06-24 上海道客网络科技有限公司 Method, system, medium and electronic device for cross-cluster elastic expansion and contraction of application
CN114666215B (en) * 2022-03-15 2023-09-08 上海道客网络科技有限公司 Method, system, medium and electronic equipment for applying cross-cluster elastic expansion
CN115361385A (en) * 2022-08-15 2022-11-18 山东体育学院 Cloud native application automatic elastic expansion system and expansion method in Docker Swarm environment
CN115361385B (en) * 2022-08-15 2024-05-10 山东体育学院 Automatic elastic telescoping system and telescoping method for cloud native application in Docker Swarm environment
CN115361281A (en) * 2022-08-19 2022-11-18 浙江极氪智能科技有限公司 Processing method, device, equipment and medium for capacity expansion of multiple cloud cluster nodes
CN115361281B (en) * 2022-08-19 2023-09-22 浙江极氪智能科技有限公司 Processing method, device, equipment and medium for expanding capacity of multiple cloud cluster nodes

Similar Documents

Publication Publication Date Title
CN113867957A (en) Method and device for realizing elastic expansion of number of cross-cluster containers
CN108632365B (en) Service resource adjusting method, related device and equipment
US10860441B2 (en) Method and system for data backup and restoration in cluster system
US10715460B2 (en) Opportunistic resource migration to optimize resource placement
US10356150B1 (en) Automated repartitioning of streaming data
CN106339386B (en) Database flexible scheduling method and device
CN105530306A (en) Hyper-converged storage system supporting data application service
CN110008018A (en) A kind of batch tasks processing method, device and equipment
US10169139B2 (en) Using predictive analytics of natural disaster to cost and proactively invoke high-availability preparedness functions in a computing environment
CN105242983A (en) Data storage method and data storage management server
CN111784329A (en) Service data processing method and device, storage medium and electronic device
US10783005B2 (en) Component logical threads quantity adjustment method and device
EP4170491A1 (en) Resource scheduling method and apparatus, electronic device, and computer-readable storage medium
CN111045811A (en) Task allocation method and device, electronic equipment and storage medium
CN111104227A (en) Resource control method and device of K8s platform and related components
CN114625533A (en) Distributed task scheduling method and device, electronic equipment and storage medium
CN114911598A (en) Task scheduling method, device, equipment and storage medium
CN103631600A (en) Data processing method and system for embedded RFID (radio frequency identification) middleware
CN110096339B (en) System load-based capacity expansion and contraction configuration recommendation system and method
CN111752545A (en) Stream computing method supporting data replay
EP2776941B1 (en) Managing capacity in a data center by suspending tenants
CN111125046A (en) Cross-system file sharing system and method based on unstructured platform
CN115250227A (en) Scheduling system for realizing fault migration in edge computing scene
CN106888244B (en) Service processing method and device
CN114237858A (en) Task scheduling method and system based on multi-cluster network

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