Container group capacity expanding and shrinking method and device
By providing container group scaling methods and devices on the serviceless application management platform, it supports switching of multiple scaling modes, solving the problem that the platform does not support flexible switching, and improving user experience and security.
Patent Information
- Application Number
- CN202411793409.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
The serviceless application management platform does not support fast lossless and flexible switching of multiple scaling modes, which reduces user experience and has security issues in production environments.
A container group expansion and capacity expansion method and device are provided, which can receive a switching request, set the expansion and capacity mode identification of the containerized application according to the switching indication information, and use the corresponding tuner components to perform expansion and capacity management, supporting flexible switching between multiple modes.
It realizes rapid lossless and flexible switching of container group expansion and capacity mode, improves the user experience of container group expansion and capacity management, and reduces operation and maintenance complexity.
Smart Images

Figure CN119645653A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for scaling a container group. Background Art
[0002] Serverless architecture is a cloud computing execution model that allows developers to build and run applications and services without managing servers. In this model, the cloud service provider is responsible for tasks such as server maintenance, capacity provisioning, expansion, and patching, and developers only need to write and deploy code.
[0003] Serverless application management platforms are used to build, deploy, and manage serverless applications. For example, Knative is a serverless application management platform built on the container orchestration system Kubernetes, which aims to simplify the process of developing and running containerized applications. Knative has complete automatic scaling capabilities.
[0004] In related technologies, serverless application management platforms often use fixed automatic scaling modes (such as KPA mode or HPA mode) to manage the scaling of containerized applications. Summary of the invention
[0005] The present disclosure provides a method and device for scaling up and down a container group.
[0006] According to a first aspect of the present disclosure, a method for scaling a container group is provided, comprising: receiving a switching request for a scaling mode of a containerized application, the switching request comprising switching indication information, the switching indication information being used to indicate that the scaling mode is switched to a specified mode; according to the switching indication information, setting a scaling mode identifier of a revision resource of the containerized application and a scaling mode identifier of a container group scaling description resource corresponding to the revision resource to an identifier of the specified mode; and utilizing a tuner component corresponding to the specified mode to perform scaling management on the container group where the containerized application is located.
[0007] In some embodiments, setting the scaling mode identifier of the revision resource of the containerized application and the scaling mode identifier of the container group scaling description resource corresponding to the revision resource to the identifier of the specified mode according to the switching indication information includes: setting the scaling mode identifier of the revision resource of the containerized application to the identifier of the specified mode according to the switching indication information; determining whether the scaling mode identifier of the container group scaling description resource corresponding to the revision resource is the identifier of the specified mode; and setting the scaling mode identifier of the container group scaling description resource to the identifier of the specified mode when the scaling mode identifier of the container group scaling description resource is not the identifier of the specified mode.
[0008] In some embodiments, setting the scaling mode identifier of the revision resource of the containerized application and the scaling mode identifier of the container group scaling description resource corresponding to the revision resource to the identifier of the specified mode according to the switching indication information further includes: when the scaling mode identifier of the container group scaling description resource is the identifier of the specified mode, keeping the scaling mode identifier of the container group scaling description resource unchanged.
[0009] In some embodiments, the specified mode is a manual scaling mode, and using the tuner component corresponding to the specified mode to manage the scaling of the container group where the containerized application is located includes: using the tuner component corresponding to the specified mode to query the container group scaling description resource to obtain the identification information of the workload corresponding to the revision resource; obtaining the replica value of the workload indicated by the identification information; if the replica value of the workload is inconsistent with the number of replicas configured by the user in the manual scaling mode, modifying the replica value of the workload; and expanding or shrinking the container group where the containerized application is located according to the modified replica value of the workload.
[0010] In some embodiments, the use of the tuner component corresponding to the specified mode to manage the scaling of the container group where the containerized application is located also includes: when the replica value of the workload is consistent with the number of replicas configured by the user in the manual scaling mode, keeping the replica value of the workload unchanged.
[0011] In some embodiments, the switching request also includes replica number indication information, and the number of replicas configured by the user in the manual scaling mode is determined based on the replica number indication information.
[0012] In some embodiments, the container group scaling method further includes: before receiving a request to switch the scaling mode for the containerized application, using a tuner component corresponding to the automatic scaling mode to manage the scaling of the container group where the containerized application is located.
[0013] In some embodiments, the automatic expansion and contraction mode is a container group automatic expansion and contraction mode based on the number of concurrent requests, or a horizontal container group automatic expansion and contraction HPA mode.
[0014] In some embodiments, the specified mode is an automatic scaling mode, and the method further includes: before receiving a request to switch the scaling mode for the containerized application, using a tuner component corresponding to the manual scaling mode to manage the scaling of the container group where the containerized application is located.
[0015] In some embodiments, the specified mode is an automatic scaling mode of a container group based on a concurrent number of requests, and the method further includes: before receiving a request to switch the scaling mode for a containerized application, using a tuner component corresponding to an automatic scaling HPA mode of a horizontal container group to manage scaling of the container group where the containerized application is located; or, the specified mode is an automatic scaling HPA mode of a horizontal container group, and the method further includes: before receiving a request to switch the scaling mode for a containerized application, using a tuner component corresponding to an automatic scaling mode of a container group based on a concurrent number of requests to manage scaling of the container group where the containerized application is located.
[0016] In some embodiments, the container group scaling description resource is a PodAutoscaler resource.
[0017] According to a second aspect of the present disclosure, a container group expansion and contraction device is provided, comprising: a module for executing the container group expansion and contraction method as described above.
[0018] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the container group expansion and contraction method as described above based on instructions stored in the memory.
[0019] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the instructions are executed by a processor, the container group scaling method as described above is implemented.
[0020] According to a fifth aspect of the present disclosure, a computer program product is provided, on which computer program instructions are stored, and when the instructions are executed by a processor, the container group scaling method as described above is implemented.
[0021] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] Figure 1 is a flowchart of a method for scaling a container group according to some embodiments of the present disclosure;
[0024] Figure 2 is a flowchart of a method for scaling a container group according to other embodiments of the present disclosure;
[0025] Figure 3 is a flowchart of a method for scaling a container group according to some further embodiments of the present disclosure;
[0026] Figure 4 is a schematic structural diagram of a container group expansion and contraction device according to some embodiments of the present disclosure;
[0027] Figure 5 is a schematic diagram of the structure of an electronic device according to some embodiments of the present disclosure;
[0028] Figure 6 It is a schematic diagram of the structure of a container group expansion and contraction system according to some embodiments of the present disclosure.
[0029] The present disclosure can be more clearly understood from the following detailed description with reference to the accompanying drawings. DETAILED DESCRIPTION
[0030] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0031] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0032] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0033] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.
[0034] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0035] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0036] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0037] The inventors of the present disclosure have discovered that the serverless application management platform in the related art has the following problems: first, the serverless application management platform does not support fast, lossless and flexible switching between multiple scaling modes, which reduces the user experience; second, in a real production environment scenario, if the scaling of containerized applications is managed in a fully automatic mode, there will be many problems such as security, and the native Knative is difficult to flexibly intervene manually after using the KPA mode or HPA mode.
[0038] In view of this, the present disclosure proposes a method and device for scaling a container group, which can support flexible switching of multiple scaling modes and improve the user experience of scaling management of container groups.
[0039] Figure 1 FIG. 1 is a flow chart of a method for scaling a container group according to some embodiments of the present disclosure. Figure 1 As shown, the method for scaling a container group includes steps 11 to 13.
[0040] Step 11: Receive a request for switching the scaling mode of the containerized application.
[0041] The switching request may include switching indication information, where the switching indication information is used to indicate that the scaling mode is switched to a specified mode.
[0042] In some examples, the switching indication information is used to indicate switching the scaling mode to the manual scaling mode. For example, the switching indication information is used to indicate switching the scaling mode from the container group automatic scaling mode based on the number of concurrent requests (i.e., KPA mode, full name Knative Pod Autoscaler mode) to the manual scaling mode. For another example, the switching indication information is used to indicate switching the scaling mode from the horizontal container group automatic scaling (i.e., HPA, full name Horizontal PodAutoscaler) mode to the manual scaling mode.
[0043] In other examples, the switching indication information is used to indicate that the scaling mode is switched to the automatic scaling mode. For example, the switching indication information is used to indicate that the scaling mode is switched from the manual scaling mode to the KPA mode. For another example, the switching indication information is used to indicate that the scaling mode is switched from the manual scaling mode to the HPA mode. For another example, the switching indication information is used to indicate that the scaling mode is switched from the KPA mode to the HPA mode.
[0044] In specific implementation, before step 11, the user may submit a switching request in the console. After receiving the switching request, the console sends the switching request to the container group expansion and contraction device.
[0045] Step 12: according to the switching indication information, the scaling mode identifier of the revision resource of the containerized application and the scaling mode identifier of the container group scaling description resource corresponding to the revision resource are set to the identifier of the specified mode.
[0046] In this step, it is first determined according to the switching indication information for which revision resource of which containerized application the scaling mode switching needs to be performed, and then the scaling mode identifier of the specified Revision resource of the specified containerized application determined thereby and the scaling mode identifier of the container group scaling description resource corresponding to the specified Revision resource are set. The container group scaling description resource may be a PodAutoscaler resource.
[0047] The scaling mode identifier of the Revision and the scaling mode identifier of the PodAutoscaler resource can be represented in the form of a label or an annotation. For example, the scaling mode identifier of the Revision is represented in the form of a label, and the scaling mode identifier of the PodAutoscaler resource is represented in the form of an annotation.
[0048] For example, assuming that containerized application A includes multiple revisions, such as Revision 1, Revision 2, and Revision 3, if it is determined according to the switching indication information that the scaling mode needs to be switched for Revision 1 of containerized application A, the scaling mode identifier of Revision 1 of containerized application A is set to the identifier of the specified mode, and the scaling mode identifier of the PodAutoscaler resource corresponding to Revision 1 is set to the identifier of the specified mode.
[0049] Step 13: Use the tuner component corresponding to the specified mode to manage the expansion and contraction of the container group where the containerized application is located.
[0050] The tuner component may also be referred to as a scaling control component or a telescopic component. In some embodiments, a plurality of tuner components corresponding to the modes are pre-set. For example, a tuner component corresponding to the manual scaling mode and a tuner component corresponding to the automatic scaling mode are pre-set. The tuner component corresponding to the automatic scaling mode may be a tuner component corresponding to the KPA mode or a tuner component corresponding to the HPA mode.
[0051] In the above embodiment, when the specified mode is the manual scaling mode, the container group (Pod) where the containerized application is located is managed by using the tuner component corresponding to the manual scaling mode; when the specified mode is the KPA mode, the container group (Pod) where the containerized application is located is managed by using the tuner component corresponding to the KPA mode; when the specified mode is the HPA mode, the container group (Pod) where the containerized application is located is managed by using the tuner component corresponding to the HPA mode.
[0052] In some embodiments, when the specified mode is the manual scaling mode, the container group scaling method further includes: before receiving the switching request, using a tuner component corresponding to the automatic scaling mode to manage the scaling of the container group where the containerized application is located. The automatic scaling mode is a container group automatic scaling based on the number of concurrent requests (i.e., KPA) mode, or the automatic scaling mode is a horizontal container group automatic scaling (HPA) mode.
[0053] In some other embodiments, when the specified mode is the automatic scaling mode, the container group scaling method further includes: before receiving the switching request, using a tuner component corresponding to the manual scaling mode to manage the scaling of the container group where the containerized application is located.
[0054] In some further embodiments, when the specified mode is the KPA mode, the container group scaling method further includes: before receiving the switching request, using a tuner component corresponding to the HPA mode to manage the scaling of the container group where the containerized application is located; or, when the specified mode is the HPA mode, the container group scaling method further includes: before receiving the switching request, using a tuner component corresponding to the KPA mode to manage the scaling of the container group where the containerized application is located.
[0055] In the disclosed embodiment, by receiving a switching request and setting the scaling mode identifier of the Revision resource and the scaling mode identifier of the container group scaling description resource according to the switching request, fast, lossless and flexible switching of the container group scaling mode is achieved, thereby improving the user experience of container group scaling management.
[0056] Figure 2 FIG. 1 is a flow chart of a method for scaling a container group according to other embodiments of the present disclosure. Figure 2 As shown, the embodiments of the present disclosure Figure 1 The step S12 in the container group expansion and contraction method shown is further improved. The improved step S12 includes steps 121 to 124.
[0057] Step 121: Set the expansion / reduction mode identifier of the revision resource to the identifier of the specified mode.
[0058] In some examples, step 121 includes: after receiving the switching request, the container group scaling device first determines which revision resource of which containerized application needs to perform scaling mode switching according to the switching request, and then obtains the scaling mode identifier of the revision resource; if the scaling mode identifier of the revision resource is not the identifier of the specified mode, sets the scaling mode identifier of the revision to the identifier of the specified mode; if the scaling mode identifier of the revision resource is the identifier of the specified mode, keeps the scaling mode identifier of the revision resource unchanged.
[0059] For example, assuming that the scaling mode before switching is the KPA mode, and the specified mode after switching is the manual scaling mode, the label of the revision resource of the containerized application determined according to the switching request can be modified as follows: autoscaling.knative.dev / class: kpa.autoscaling.knative.dev is changed to autoscaling.knative.dev / class: mpa.autoscaling.knative.dev. Among them, autoscaling.knative.dev / class represents the scaling mode identifier, kpa.autoscaling.knative.dev indicates that the value of the scaling mode identifier is the KPA mode, and mpa.autoscaling.knative.dev indicates that the value of the scaling mode identifier is the manual scaling mode.
[0060] Step 122: Obtain the scaling mode identifier of the container group scaling description resource corresponding to the revision resource.
[0061] In some examples, a correspondence (or association) between revision resources and container group scaling description resources is pre-stored. In these examples, based on the correspondence, the container group scaling description resource corresponding to the revision resource is determined, and then the scaling mode identifier of the container group scaling description resource is obtained.
[0062] Step 123: Determine whether the scaling mode identifier of the container group scaling description resource is an identifier of a specified mode.
[0063] If the judgment result of step 123 is no, execute step 124; otherwise, execute step 13.
[0064] Step 124: Set the scaling mode identifier of the container group scaling description resource to the identifier of the specified mode.
[0065] After step 124, step 13 is performed.
[0066] In the embodiment of the present disclosure, lossless and flexible switching of the scaling mode of the specified revision resource of the specified containerized application is achieved through steps 121 to 124. In this way, the container group scaling device can support multiple scaling modes, improving the user experience of container group scaling.
[0067] Figure 3 FIG. 1 is a flow chart of a method for scaling a container group according to some other embodiments of the present disclosure. Figure 3 As shown, the method for scaling a container group includes steps 31 to 39.
[0068] Step 31: Receive a scaling mode switching request.
[0069] In the embodiment of the present disclosure, a container group scaling method is executed by a container group scaling device based on Knative.
[0070] In step 31, the scaling mode switching request received by the container group scaling device includes switching indication information and replica number indication information. The switching indication information is used to indicate switching the scaling mode from the automatic scaling mode to the manual scaling mode (ie, the manual mode), and the replica number indication information is used to indicate the number of replicas configured by the user.
[0071] Step 32: Set the scaling mode flag of the revision resource to the manual mode flag.
[0072] Step 33: Obtain the scaling mode identifier of the container group scaling description resource corresponding to the revision resource.
[0073] In some examples, a tuner corresponding to the manual mode is pre-built and named autoscaler-mpa so that it does not affect the tuner corresponding to the KPA mode of Knative (named autoscaler). In these examples, after the tuner corresponding to the manual mode monitors that the scaling mode flag of the Revision resource is changed to the manual mode flag, it executes step 33 and other subsequent steps.
[0074] The container group scaling description resource is specifically a PodAutoscaler resource. In step 33, the tuner corresponding to the manual mode queries the specific content of the PodAutoscaler according to the name of the PodAutoscaler corresponding to the revision resource. The specific content includes the scaling mode identifier of the PodAutoscaler.
[0075] If the scaling mode identifier of the container group scaling description resource is the identifier of the manual mode, execute step 35; otherwise, execute step 34.
[0076] Step 34: Set the scaling mode flag of the container group scaling description resource to the manual mode flag.
[0077] After step 34, step 35 is performed.
[0078] In the embodiment of the present disclosure, through steps 31 to 34, lossless and flexible switching from the automatic scaling mode to the manual scaling mode is achieved.
[0079] Step 35: Use the tuner component in manual mode to query the container group expansion and contraction description resource to obtain the identification information of the workload.
[0080] The PodAutoscaler resource records the identification information such as the name and type of the associated workload. In step 35, the PodAutoscaler resource is queried using the tuner component in manual mode to obtain the identification information such as the name and type of the workload.
[0081] Step 36: Obtain the replica value of the workload indicated by the identification information.
[0082] In this step, the replica value of the workload is obtained based on the name, type and other identification information of the workload. For example, the replica value of the deployment (Deployment, a type of workload in the container orchestration system Kubernetes) named abc is obtained.
[0083] If the replica value of the workload is consistent with the number of replicas configured by the user, execute step 39; otherwise, execute step 37.
[0084] Step 37: Modify the replica value of the workload.
[0085] Step 38: Expand or reduce the capacity of the container group where the containerized application is located according to the modified replica value.
[0086] In step 38, when the workload's replica value is less than the number of replicas configured by the user, the container group where the containerized application is located is expanded according to the modified replica value; when the workload's replica value is more than the number of replicas configured by the user, the container group where the containerized application is located is reduced according to the modified replica value.
[0087] Step 39: End.
[0088] If the replica value of the workload is consistent with the number of replicas configured by the user, it indicates that there is no need to manage the expansion and contraction of the Pod where the containerized application is located, so this process ends.
[0089] In the disclosed embodiment, through the above process, the container group scaling device not only supports the automatic scaling mode, but also supports the manual scaling mode, which makes up for the lack of manual scaling in the Knative scaling strategy, so that Knative has the ability to manually scale. Users can scale service instances in advance according to business plans and prepare in advance to avoid traffic peaks. Moreover, through the above process, the automatic scaling strategy and the manual scaling strategy are integrated, and the seamless switching of the two strategies is realized, which optimizes the user experience and reduces the operation and maintenance complexity of Knative.
[0090] Figure 4 Schematic diagram of the structure of the container group expansion and contraction device according to some embodiments of the present disclosure. Figure 4 As shown, the container group expansion and contraction device 40 is used to execute the container group expansion and contraction method as described above, and includes a receiving module 41, a setting module 42, and an expansion and contraction control module 43.
[0091] The receiving module 41 is configured to receive a switching request for a scaling mode of a containerized application, wherein the switching request includes switching indication information, and the switching indication information is used to indicate that the scaling mode is switched to a specified mode.
[0092] The setting module 42 is configured to set the scaling mode identifier of the revision resource of the containerized application and the scaling mode identifier of the container group scaling description resource corresponding to the revision resource to the identifier of the specified mode according to the switching indication information.
[0093] In some embodiments, the setup module 42 is configured to perform Figure 2 Steps 121 to 124 are shown to implement the switching of the expansion and contraction modes.
[0094] The expansion and contraction control module 43 is configured to manage the expansion and contraction of the container group where the containerized application is located by using the tuner component corresponding to the specified mode.
[0095] In some embodiments, when the specified mode is the manual scaling mode (i.e., manual mode), the scaling control module 43 is configured to: query the container group scaling description resource using the tuner component corresponding to the manual mode to obtain the identification information of the workload corresponding to the revision resource; obtain the replica value of the workload indicated by the identification information; modify the replica value of the workload when the replica value of the workload is inconsistent with the number of replicas configured by the user in the manual scaling mode; and expand or shrink the container group where the containerized application is located according to the modified replica value of the workload. In addition, when the replica value of the workload is consistent with the number of replicas configured by the user in the manual scaling mode, the scaling control module 43 is also configured to: keep the replica value of the workload unchanged.
[0096] In some examples, the switching request includes not only the switching indication information but also the replica quantity indication information. In these examples, the scaling control module 43 is further configured to: determine the number of replicas configured by the user in the manual scaling mode according to the replica quantity indication information.
[0097] In some embodiments, when the designated mode is the manual mode, the scaling control module 43 is further configured to: before the receiving module receives the switching request for the scaling mode of the containerized application, use the tuner component corresponding to the automatic scaling mode to perform scaling management on the container group where the containerized application is located. The automatic scaling mode is a container group automatic scaling mode based on the number of concurrent requests, or a horizontal container group automatic scaling (HPA) mode.
[0098] In some embodiments, when the specified mode is the automatic scaling mode, the scaling control module 43 is also configured to: before the receiving module receives a request to switch the scaling mode for the containerized application, use the tuner component corresponding to the manual scaling mode to manage the scaling of the container group where the containerized application is located.
[0099] In the embodiments of the present disclosure, the above device can support flexible switching of multiple container group expansion and contraction modes, thereby improving the user experience of container group expansion and contraction management.
[0100] Figure 5 is a schematic diagram of the structure of an electronic device according to some embodiments of the present disclosure. Figure 5 As shown, the electronic device 50 includes a memory 51 and a processor 52 coupled to the memory 51. The memory 51 is used to store instructions for executing the container group expansion and contraction method corresponding to the embodiment. The processor 52 is configured to execute the container group expansion and contraction method in any of the embodiments of the present disclosure based on the instructions stored in the memory 51.
[0101] Figure 6Schematic diagram of the structure of the container group expansion and contraction system according to some embodiments of the present disclosure. Figure 6 As shown, the container group scaling system is created based on Knative, including a first tuner component 61, a second tuner component 62, a revision 63, a PA 64, a deployment 65, an entry 67, a serverless architecture service 68, and an activator 69.
[0102] The first tuner component 61, also called the MPA Autoscaler component, is a pre-built tuner in manual scaling mode, used to manage scaling of container groups in manual scaling mode. The MPA Autoscaler component is used to monitor the revision resource whose scaling mode identifier is the manual mode identifier.
[0103] The second tuner component 62 may be a Knative native Autoscaler component, which is used to manage the expansion and contraction of the container group in the KPA mode. The Autoscaler component is used to monitor the revision resource whose expansion and contraction mode identifier is the KPA mode identifier.
[0104] Revision 63 refers to a specific version of an application. Whenever the code or configuration is updated, a new revision is created. This new version can be used for rollback or load distribution. Revision is the basic unit for elastic scaling in Knative, which is responsible for tracking and managing updates to application instances. Through interaction with the MPA Autoscaler component and the Autoscaler component, the number of copies of Revision is adjusted according to demand, thereby achieving dynamic expansion and contraction.
[0105] PA64, namely the PodAutoscaler resource, contains the specific logic for controlling the expansion and contraction implementation.
[0106] In some embodiments of the present disclosure, after receiving a switching request submitted by a user to switch the scaling mode to the manual mode, Knative first sets the scaling mode flag of revision 63 to the manual mode flag according to the switching request, and then the first tuner component 61 sets the scaling mode flag of PA 64 associated with revision 63 to the manual mode flag. Next, the first tuner component 61 performs manual scaling management on the user container group 66 where the containerized application is located. For example, the first tuner component 61 first compares the replica value of the workload corresponding to PA64 (such as deployment 65) to see if it is the same as the number of replicas configured by the user. If different, modify the replica value of the workload corresponding to PA64 to trigger the expansion or reduction operation of the user container group 66.
[0107] In some other embodiments of the present disclosure, after receiving a switching request submitted by a user to switch the scaling mode from the manual mode to the KPA mode, Knative first sets the scaling mode flag of the revision 63 to the KPA mode flag according to the switching request, and then the second tuner component 62 sets the scaling mode flag of the PA 64 associated with the revision 63 to the KPA mode flag. Next, the second tuner component 62 performs automatic scaling management based on the number of concurrent requests for the user container group 66 where the containerized application is located.
[0108] Entry 67 refers to the traffic entry, which can be understood as a traffic gateway.
[0109] Serverless Architecture Service 68, referred to as SKS, is mainly used in Knative to manage public and private network access to services. It coordinates the connection between private services (Private Service) and public services (Public Service). Figure 6 As shown, the serverless architecture service 68 can update the status of the service (update the Public Service or Private Service) according to the demand, and notify the instance in the Revision to adjust the access traffic. Specifically, SKS provides an external access interface through the Public Service, while managing the Private Service in the private network. This design allows the service to automatically expand when there is traffic and reduce the number of instances when there is no traffic, thereby achieving cost optimization.
[0110] Activator 69, whose main function is to help achieve request-driven elastic scaling. It receives requests when the service has no running instances to ensure that traffic is effectively managed. When the number of instances is 0 or insufficient, Activator 69 can temporarily receive and cache requests and notify the Autoscaler component to start new instances. When a new Pod is started, Activator 69 can forward cached requests to the new instance. This is especially important in the "cold start" scenario to ensure that service requests are not lost due to insufficient instances.
[0111] In the embodiments of the present disclosure, the scaling capability of Knative is enhanced by extending the scaling strategy of Knative, and the switching of different scaling strategies is supported, thereby reducing the cost of use.
[0112] Here, various aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, devices, and computer program products according to embodiments of the present disclosure. It should be understood that each frame of the flowchart and / or block diagram and the combination of frames can be implemented by computer-readable program instructions.
[0113] These computer-readable program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable device to produce a machine, so that the processor executes the instructions to produce means for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0114] These computer-readable program instructions may also be stored in a computer-readable memory, which cause the computer to work in a specific manner to produce an article of manufacture, including instructions for implementing the functions specified in one or more blocks in the flowchart and / or block diagram.
[0115] The present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.
[0116] The container group scaling method and device in the above embodiment can support flexible switching of multiple scaling modes, thereby improving the user experience of container group scaling management.
[0117] So far, the container group expansion and contraction method and device according to the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.
Claims
1. A method for scaling a container group, comprising: Receiving a request for switching a scaling mode of a containerized application, the switching request including switching indication information, the switching indication information being used to indicate switching the scaling mode to a specified mode; According to the switching indication information, the expansion / reduction mode identifier of the revision resource of the containerized application and the expansion / reduction mode identifier of the container group expansion / reduction description resource corresponding to the revision resource are set to the identifier of the specified mode; The tuner component corresponding to the specified mode is used to manage the expansion and contraction of the container group where the containerized application is located.
2. The method for expanding and contracting a container group according to claim 1, wherein: The step of setting the scaling mode identifier of the revision resource of the containerized application and the scaling mode identifier of the container group scaling description resource corresponding to the revision resource to the identifier of the specified mode according to the switching indication information includes: According to the switching indication information, setting the scaling mode identifier of the revised version resource of the containerized application to the identifier of the specified mode; Determine whether the scaling mode identifier of the container group scaling description resource corresponding to the revision resource is the identifier of the specified mode; When the scaling mode identifier of the container group scaling description resource is not an identifier of the specified mode, the scaling mode identifier of the container group scaling description resource is set to an identifier of the specified mode.
3. The method for expanding and contracting a container group according to claim 2, wherein: The step of setting the expansion / reduction mode identifier of the revision resource of the containerized application and the expansion / reduction mode identifier of the container group expansion / reduction description resource corresponding to the revision resource to the identifier of the specified mode according to the switching indication information further includes: When the scaling mode identifier of the container group scaling description resource is the identifier of the specified mode, the scaling mode identifier of the container group scaling description resource is kept unchanged.
4. The method for expanding and contracting a container group according to any one of claims 1 to 3, wherein: The specified mode is a manual expansion and contraction mode, and the use of a tuner component corresponding to the specified mode to perform expansion and contraction management on the container group where the containerized application is located includes: Using the tuner component corresponding to the specified mode, querying the container group expansion and contraction description resource to obtain identification information of the workload corresponding to the revision resource; Obtaining a replica value of the workload indicated by the identification information; When the replica value of the workload is inconsistent with the number of replicas configured by the user in the manual expansion and contraction mode, modify the replica value of the workload; The container group where the containerized application is located is expanded or reduced according to the modified replica value of the workload.
5. The method for expanding and contracting a container group according to claim 4, wherein: The using the tuner component corresponding to the specified mode to manage the expansion and contraction of the container group where the containerized application is located also includes: When the replica value of the workload is consistent with the number of replicas configured by the user in the manual expansion and contraction mode, the replica value of the workload is kept unchanged.
6. The method for expanding and contracting a container group according to claim 4, wherein: The switching request also includes replica quantity indication information, and the replica quantity configured by the user in the manual expansion and contraction mode is determined according to the replica quantity indication information.
7. The method for expanding and contracting a container group according to claim 4, further comprising: Before receiving the request for switching the scaling mode of the containerized application, scaling management is performed on the container group where the containerized application is located using a tuner component corresponding to the automatic scaling mode.
8. The method for expanding and contracting a container group according to claim 7, wherein: The automatic expansion and contraction mode is a container group automatic expansion and contraction mode based on the number of concurrent requests, or a horizontal container group automatic expansion and contraction HPA mode.
9. The method for expanding and contracting a container group according to any one of claims 1 to 3, wherein: The specified mode is an automatic expansion and contraction mode, and the method further includes: Before receiving the request for switching the scaling mode of the containerized application, the scaling management of the container group where the containerized application is located is performed using a tuner component corresponding to the manual scaling mode.
10. The method for expanding and contracting a container group according to any one of claims 1 to 3, wherein: The specified mode is a container group automatic expansion and contraction mode based on the number of concurrent requests, and the method further includes: before receiving a request to switch the expansion and contraction mode for the containerized application, using a tuner component corresponding to the horizontal container group automatic expansion and contraction HPA mode to perform expansion and contraction management on the container group where the containerized application is located; or The specified mode is the horizontal container group automatic scaling HPA mode, and the method also includes: before receiving a request to switch the scaling mode for the containerized application, using a tuner component corresponding to the container group automatic scaling mode based on the number of concurrent requests to manage the scaling of the container group where the containerized application is located.
11. The method for expanding and contracting a container group according to any one of claims 1 to 3, wherein: The container group scaling description resource is a PodAutoscaler resource.
12. A container group expansion and contraction device, comprising: A module for executing the method for scaling a container group as claimed in any one of claims 1 to 11.
13. An electronic device, comprising: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the container group expansion and contraction method according to any one of claims 1 to 11 based on instructions stored in the memory.
14. A computer-readable storage medium having computer program instructions stored thereon, wherein when the instructions are executed by a processor, the method for scaling a container group as claimed in any one of claims 1 to 11 is implemented.
15. A computer program product having computer program instructions stored thereon, wherein when the instructions are executed by a processor, the method for scaling a container group according to any one of claims 1 to 11 is implemented.