Capacity control method and device for containerized application and electronic device
By analyzing the access request protocol packets of containerized applications, dynamically adjusting the capacity of containerized applications, solving the problem of unbalanced traffic caused by surges or sharp drops in access, and achieving stable operation of containerized applications.
Patent Information
- Application Number
- CN202311574370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
When containerized applications are deployed on the container service management platform, unbalanced traffic caused by surges or sharp drops in access causes impact on the operation of containerized applications, which is difficult to effectively solve in the existing technology.
By receiving and parsing access request protocol messages from containerized applications, obtaining the number of valid access requests and the number of valid transmission control protocol connections, dynamically expanding or reducing containerized applications based on these indicators to balance traffic.
It effectively avoids the impact of unbalanced traffic during the surge or sharp drop in access to the operation of containerized applications, ensuring the stability and performance of the application.
Smart Images

Figure CN120029753A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home, and in particular to a capacity control method, device and electronic device for containerized applications. Background Art
[0002] As enterprises' requirements for operation and maintenance increase and the containerization process accelerates, applications (also known as APP applications) need to be containerized to obtain containerized applications.
[0003] It is known from related technologies that dynamic expansion or contraction of containerized applications deployed on container service management platforms is often based on the dynamic expansion or contraction capabilities of the CPU or memory. However, in the case of a surge or decrease in access, unbalanced traffic will be generated, and since the expansion or contraction of the CPU or memory is not obvious, it will have an impact on the operation of the containerized application. Summary of the invention
[0004] The present application provides a method, device and electronic device for controlling the capacity of a containerized application, which can expand or shrink the capacity of the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections, thereby effectively avoiding the impact of unbalanced traffic generated when access surges or decreases on the operation of the containerized application.
[0005] The present application provides a capacity control method for a containerized application, which is applied to a container service management platform based on a Kubernetes mechanism, wherein the containerized application is deployed on the container service management platform, and the method comprises: receiving a protocol message of an access request of the containerized application within a current time period; parsing the protocol message based on a proxy container of the container service management platform to obtain a parsing result, wherein the parsing result comprises a valid access request number and / or a valid transmission control protocol connection number, wherein the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; and scaling up or down the containerized application based on the valid access request number and / or the valid transmission control protocol connection number.
[0006] According to a capacity control method for a containerized application provided by the present application, the capacity expansion or contraction of the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections specifically includes: determining access indicator information based on the number of valid access requests and / or the number of valid transmission control protocol connections, wherein the access indicator information is used to characterize the comparison between the number of valid access requests in the current time period and the number of valid access requests in the previous time period, and / or the comparison between the number of valid transmission control protocol connections in the current time period and the number of valid transmission control protocol connections in the previous time period; based on the access indicator information, the containerized application is expanded or contracted.
[0007] According to a capacity control method for a containerized application provided by the present application, before the containerized application is expanded or reduced in capacity based on the access indicator information, the method also includes: registering the access indicator information to a server application program interface of the container service management platform; and reading the access indicator information from the server application program interface.
[0008] According to a capacity control method for a containerized application provided by the present application, the capacity expansion or contraction of the containerized application is performed based on the access indicator information, specifically including: when the access indicator information is first access indicator information, the capacity expansion of the containerized application is performed, wherein the first access indicator information is that the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period; when the access indicator information is second access indicator information, the capacity contraction of the containerized application is performed, wherein the second access indicator information is that the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period.
[0009] According to a capacity control method for a containerized application provided by the present application, the capacity expansion processing of the containerized application is implemented in the following manner: increasing the number of minimum working units of the container service management platform to achieve capacity expansion processing of the containerized application; the capacity reduction processing of the containerized application is implemented in the following manner: reducing the number of minimum working units of the container service management platform to achieve capacity reduction processing of the containerized application.
[0010] According to a capacity control method for a containerized application provided by the present application, the protocol message includes a transmission control protocol and access device information; the protocol message is parsed based on the proxy container in the container service management platform, specifically including: judging whether the transmission control protocol is the valid transmission control protocol based on the proxy container; judging whether the access device is a registered access device based on the access device information when the transmission control protocol is the valid transmission control protocol; and taking the access request corresponding to the protocol message as the valid access request when the access device is a registered access device; counting the number of valid access requests and the number of valid transmission control protocol connections within the current time period, and taking the number of valid access requests and the number of valid transmission control protocol connections within the current time period as the parsing result.
[0011] According to a capacity control method for a containerized application provided in the present application, after determining whether the access device is a registered access device based on the access device information, the method further includes: if the access device is not a registered access device, stopping responding to the access request corresponding to the protocol message.
[0012] The present application also provides a capacity control device for containerized applications, which is applied to a container service management platform based on a Kubernetes mechanism, wherein the containerized application is deployed on the container service management platform, and the device includes: a receiving module, which is used to receive a protocol message of an access request of the containerized application within a current time period; a parsing module, which is used to parse the protocol message based on a proxy container of the container service management platform to obtain a parsing result, wherein the parsing result includes a valid access request number and / or a valid transmission control protocol connection number, wherein the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; and a processing module, which is used to expand or reduce the capacity of the containerized application based on the valid access request number and / or the valid transmission control protocol connection number.
[0013] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the capacity control method of any of the containerized applications described above through the computer program.
[0014] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is run, it executes and implements the capacity control method of the containerized application as described in any one of the above.
[0015] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the capacity control method for containerized applications as described in any one of the above.
[0016] The capacity control method, device and electronic device of containerized applications provided in the present application are applied to a container service management platform based on the Kubernetes mechanism. The container service management platform is deployed with a containerized application. In the current time period, the protocol message of the access request of the containerized application is received; based on the proxy container of the container service management platform, the protocol message is parsed to obtain the number of valid access requests and / or the number of valid transmission control protocol connections; then based on the number of valid access requests and / or the number of valid transmission control protocol connections, the containerized application is expanded or reduced in capacity, so that the containerized application can be expanded or reduced in capacity according to the access situation of the containerized application, effectively avoiding the impact of the unbalanced traffic generated in the case of a surge or decrease in access on the operation of the containerized application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 is a hardware environment schematic diagram of a capacity control method for a containerized application according to an embodiment of the present application;
[0020] Figure 2 It is a flow chart of the capacity control method of containerized application provided by the present application;
[0021] Figure 3 It is a flowchart of expanding or shrinking a containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections provided by the present application;
[0022] Figure 4 This is a flow chart of parsing a protocol message based on a proxy container in a container service management platform provided by the present application;
[0023] Figure 5 This is a schematic diagram of the architecture of the container service management platform based on the Kubernetes mechanism provided by this application;
[0024] Figure 6 It is a structural schematic diagram of a capacity control device for containerized applications provided by the present application;
[0025] Figure 7 It is a schematic diagram of the structure of the electronic device provided in this application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] According to one aspect of an embodiment of the present application, a method for controlling the capacity of a containerized application is provided. The method for controlling the capacity of a containerized application is widely used in smart home, smart home, smart home device ecosystem, smart home ecosystem and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the method for controlling the capacity of a containerized application can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.
[0029] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0030] In another embodiment, the capacity control method of containerized applications provided in this application can be applied to smart home appliances. Among them, smart home appliances refer to home appliances formed by introducing microprocessors, sensor technology, and network communication technology into home appliances, which have the function of automatically sensing the state of residential space, the state of the home appliances themselves, and the state of home appliance services, and can automatically control and receive control instructions from residential users in the home or remotely. It can be understood that smart home appliances are a component of smart homes.
[0031] Figure 2 It is a flow chart of the capacity control method of containerized applications provided in this application.
[0032] In order to further introduce the capacity control method of containerized applications provided by this application, Figure 2 Provide explanation.
[0033] In an exemplary embodiment of the present application, the containerized application can be deployed on a container service management platform based on the Kubernetes mechanism. It is understandable that the application subject of the present application can be a container service management platform based on the Kubernetes mechanism, wherein the container service management platform is deployed with the containerized application. Figure 2 It can be seen that the capacity control method for containerized applications may include steps 210 to 230, and each step will be introduced below.
[0034] In step 210, a protocol message of an access request of a containerized application is received within a current time period.
[0035] In one embodiment, a protocol message of an access request of a containerized application may be received within a current time period.
[0036] It should be noted that in the present application, access requests are received in units of a time period, and subsequent processing is performed based on the access requests in order to achieve the query rate per second (also known as QPS), that is, to expand or shrink the containerized application according to the access situation of the containerized application, thereby effectively avoiding the impact of unbalanced traffic generated in the case of a surge or sudden decrease in access on the operation of the containerized application.
[0037] In another example, the container service management platform is a container service management platform based on the Kubernetes mechanism. Multiple containerized applications are deployed on the container service management platform.
[0038] In step 220, the proxy container based on the container service management platform parses the protocol message to obtain a parsing result.
[0039] In step 230, the containerized application is expanded or reduced in capacity based on the number of valid access requests and / or the number of valid TCP connections.
[0040] In one embodiment, the protocol message can be intercepted, forwarded, and parsed by a proxy container at the protocol layer of the container service management platform, and the parsing result can be obtained, thereby laying a foundation for expanding or shrinking the containerized application based on the parsing result.
[0041] The parsing result may include the number of valid access requests and / or the number of valid transmission control protocol connections, where a valid access request is an access request that is allowed to be accessed, and a valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by a proxy container.
[0042] It should be noted that a valid access request refers to an access request that is allowed to access. In the application process, the protocol message of the access request includes a transmission control protocol. If the transmission control protocol is not an allowed transmission control protocol, then the access request can be considered not to be a valid access request. Among them, the allowed transmission control protocol can be determined according to actual conditions, for example, it can be an E++ protocol. In this embodiment, the allowed transmission control protocol is not specifically limited.
[0043] In another embodiment, the capacity of the containerized application may be expanded or reduced based on the number of valid access requests and / or the number of valid transmission control protocol connections, thereby enabling the containerized application to be expanded or reduced according to the access situation to the containerized application, thereby effectively avoiding the impact of unbalanced traffic generated when access surges or decreases on the operation of the containerized application.
[0044] Figure 3This is a flowchart of expanding or shrinking a containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections provided by the present application.
[0045] The following will be combined Figure 3 The process of scaling a containerized application up or down based on the number of valid access requests and / or the number of valid transmission control protocol connections is described.
[0046] In an exemplary embodiment of the present application, Figure 3 It can be seen that based on the number of valid access requests and / or the number of valid transmission control protocol connections, the expansion or reduction processing of the containerized application may include step 310 and step 320, and each step will be introduced below.
[0047] In step 310, access index information is determined based on the number of valid access requests and / or the number of valid TCP connections.
[0048] In step 320, the containerized application is expanded or reduced in capacity based on the access indicator information.
[0049] In one embodiment, Prometheus in the container service management platform can periodically collect access indicator information transmitted by the proxy container. And register the access indicator information to the server application program interface (also known as API server) of the container service management platform. Among them, the access indicator information is used to characterize the comparison between the number of valid access requests in the current time period and the number of valid access requests in the previous time period, and\or the comparison between the number of valid transmission control protocol connections in the current time period and the number of valid transmission control protocol connections in the previous time period.
[0050] Furthermore, the capacity of containerized applications can be expanded or reduced based on the access indicator information, thereby effectively avoiding the impact of unbalanced traffic caused by a surge or decrease in access on the operation of containerized applications.
[0051] In another exemplary embodiment of the present application, the above-described embodiment is continued to be used as an example for explanation. Before the containerized application is expanded or reduced in capacity based on the access index information (corresponding to step 320), the capacity control method of the containerized application may further include:
[0052] Register access indicator information to the server application programming interface of the container service management platform;
[0053] Reading access indicator information from the server application program interface. In one embodiment, the access indicator information can be read from the server application program interface, wherein the HPA expands or shrinks the containerized application according to the access indicator information provided by the APISERVER.
[0054] Among them, HPA is a resource object of Kubernetes, which can dynamically scale the number of Pods in sets such as statefulSet, replica Set, and deployment according to certain indicators, so that the services running on it have a certain degree of adaptability to changes in indicators.
[0055] Through the aforementioned embodiments, the HPA solutions of QPS of different back-end technology stacks can be unified through protocol proxy; and the platform capabilities and businesses can be decoupled through non-invasive integration, so that business development can focus on the business itself. The general capabilities are well unified on the platform, which achieves standardized processing and greatly reduces the subsequent maintenance costs.
[0056] In another exemplary embodiment of the present application, the above-mentioned embodiment is continued to be used as an example for description, wherein, based on the access indicator information, the containerized application is expanded or reduced in capacity (corresponding to step 320), which can be implemented in the following manner:
[0057] When the access indicator information is the first access indicator information, the containerized application is expanded, wherein the first access indicator information is that the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period;
[0058] When the access indicator information is the second access indicator information, the containerized application is scaled down, wherein the second access indicator information is that the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period.
[0059] In one embodiment, when the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period, it means that the access volume in the current time period is greater than the access volume in the previous time period. In order to meet the processing capacity requirements, the containerized application needs to be expanded.
[0060] In another exemplary embodiment of the present application, the expansion of the containerized application may be implemented in the following manner:
[0061] Increase the number of minimum work units (also known as PODs) of the container service management platform to achieve capacity expansion for containerized applications.
[0062] It should be noted that Pod is the smallest working unit of Kubernetes (the unit that provides applications). Each Pod contains one or more containers. The containers in the Pod will be scheduled as a whole by the Master to run on a Node. In this embodiment, the number of PODs of the container service management platform can be increased to achieve capacity expansion of containerized applications.
[0063] In one embodiment, when the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period, it means that the access volume in the current time period is less than the access volume in the previous time period. Under the premise of ensuring processing capacity, in order not to waste resources, the containerized application can be scaled down.
[0064] In another exemplary embodiment of the present application, scaling down the containerized application may be implemented in the following manner:
[0065] Reduce the number of minimum work units (also known as PODs) of the container service management platform to achieve downscaling of containerized applications.
[0066] Figure 4 This is a flow chart of parsing protocol messages based on a proxy container in a container service management platform provided by the present application.
[0067] The following will be combined Figure 4 The process of parsing protocol messages based on the proxy container in the container service management platform is described.
[0068] In an exemplary embodiment of the present application, the protocol message may include a transmission control protocol and access device information. Figure 4 It can be seen that parsing the protocol message based on the proxy container in the container service management platform may include steps 410 to 440, and each step will be introduced below.
[0069] In step 410, based on the proxy container, it is determined whether the TCP is a valid TCP.
[0070] In step 420, when the transmission control protocol is a valid transmission control protocol, it is determined whether the access device is a registered access device based on the access device information.
[0071] In step 430, when the access device is a registered access device, the access request corresponding to the protocol message is regarded as a valid access request.
[0072] In step 440, the number of valid access requests and the number of valid transmission control protocol connections in the current time period are counted, and the number of valid access requests and the number of valid transmission control protocol connections in the current time period are used as the analysis result.
[0073] In one embodiment, the transmission control protocol can be identified based on the proxy container to determine whether the transmission control protocol is a valid transmission control protocol. In one example, a table can be pre-set, and the table includes various valid transmission control protocols. By traversing the table, it can be determined whether the transmission control protocol is a valid transmission control protocol.
[0074] Furthermore, when the transmission control protocol is a valid transmission control protocol, it can be further determined based on the access device information whether the access device is a registered access device. Among them, a registered access device refers to a preset registered device that can access the containerized application. During the application process, by identifying the access device, if the access device is a registered access device, the access request corresponding to the protocol message will be regarded as a valid access request. In other words, the access request in this scenario will truly affect the access volume of the containerized application.
[0075] In another embodiment, the number of valid access requests and the number of valid transmission control protocol connections in the current time period are counted, and the number of valid access requests and the number of valid transmission control protocol connections in the current time period are used as the parsing result, thereby laying a foundation for scaling containerized applications based on the number of valid access requests and / or the number of valid transmission control protocol connections.
[0076] In another exemplary embodiment of the present application, the above-described embodiment is continued to be used as an example for explanation. After determining whether the access device is a registered access device based on the access device information (corresponding to step 420), the method for scaling the containerized application further includes:
[0077] When the access device is not a registered access device, stop responding to the access request corresponding to the protocol message.
[0078] In one embodiment, when it is determined that the access device is not a registered access device, the access request corresponding to the protocol message can be stopped from being responded to, thereby reducing the access traffic. In another example, the data reported by the access device, i.e., the unregistered device, can be filtered to reduce the access traffic.
[0079] Figure 5 This is a schematic diagram of the architecture of the container service management platform based on the Kubernetes mechanism provided in this application.
[0080] In order to further introduce the capacity control method of containerized applications provided by this application, Figure 5 The architecture diagram of the container service management platform based on the Kubernetes mechanism is shown for explanation.
[0081] In one embodiment, in combination Figure 5 It can be seen that business access can send protocol packets corresponding to access requests to SLB (Server Load Balancing), which is the load balancing service at the network entrance. Furthermore, SLB can also forward protocol packets corresponding to access requests to the service of the container service management platform based on the Kubernetes mechanism. Among them, service can be understood as a load balancer for containerized applications.
[0082] Understandably, Figure 5 The framed K8S part can represent a container service management platform based on the kubernetes mechanism.
[0083] In another embodiment, the Service may forward the protocol message corresponding to the access request to the proxy container. The proxy container identifies the protocol, and when it is determined that the protocol is a valid transmission control protocol, it may also determine whether the access device is a registered access device based on the access device information included in the protocol message. If the access device is a registered access device, the access request corresponding to the protocol message is regarded as a valid access request. If it is determined that the access device is not a registered access device, the data reported by the access device, i.e., an unregistered device, may be filtered, thereby reducing access traffic.
[0084] In another embodiment, the proxy container may forward the protocol message to the service container, record the number of valid access requests and the number of valid transmission control protocol connections in the current time period, and provide a standard query externally.
[0085] Furthermore, Prometheus can obtain pod registration information based on the service, regularly collect access indicators (including the number of valid access requests and valid transmission control protocol connections in the current time period) transmitted by the proxy container, and register the access indicators in the API server. HPA can periodically scale containerized applications and adjust the number of pods based on the access indicators provided by the API server.
[0086] In one embodiment, when the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period, it means that the access volume in the current time period is greater than the access volume in the previous time period. In order to meet the processing capacity requirements, the containerized application needs to be expanded.
[0087] In another example, the number of PODs of the container service management platform may be increased to achieve capacity expansion for containerized applications.
[0088] In another embodiment, when the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period, it means that the access volume in the current time period is less than the access volume in the previous time period. Under the premise of ensuring processing capacity, in order not to waste resources, the containerized application can be scaled down.
[0089] In one embodiment, the number of PODs of the container service management platform may be reduced to achieve scaling down of containerized applications.
[0090] According to the foregoing description, the capacity control method for containerized applications provided in the present application is applied to a container service management platform based on the Kubernetes mechanism. The container service management platform is deployed with a containerized application. In the current time period, the protocol message of the access request of the containerized application; based on the proxy container of the container service management platform, the protocol message is parsed to obtain the number of valid access requests and\or the number of valid transmission control protocol connections; then based on the number of valid access requests and\or the number of valid transmission control protocol connections, the containerized application is expanded or reduced in capacity, so that the containerized application can be expanded or reduced in capacity according to the access situation of the containerized application, effectively avoiding the impact of the unbalanced traffic generated in the case of a surge or sudden decrease in access on the operation of the containerized application.
[0091] Figure 6It is a structural schematic diagram of a capacity control device for containerized applications provided in this application.
[0092] The capacity control device for a containerized application provided in the present application is described below. The capacity control device for a containerized application described below and the capacity control method for a containerized application described above can refer to each other.
[0093] In an exemplary embodiment of the present invention, Figure 6 It can be seen that the capacity control device for containerized applications can be applied to a container service management platform based on the Kubernetes mechanism, and the container service management platform is deployed with the containerized application. The capacity control device for containerized applications can include an acquisition module 610, a parsing module 620, and a processing module 630, and each module will be introduced below.
[0094] The receiving module 610 may be configured to receive a protocol message of an access request of a containerized application within a current time period;
[0095] The parsing module 620 may be configured to parse the protocol message based on the proxy container of the container service management platform to obtain a parsing result, wherein the parsing result includes the number of valid access requests and / or the number of valid transmission control protocol connections, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container;
[0096] The processing module 630 may be configured to scale up or scale down the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections.
[0097] In an exemplary embodiment of the present application, the processing module 630 may implement the following method to expand or reduce the capacity of the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections:
[0098] Based on the number of valid access requests and / or the number of valid transmission control protocol connections, access indicator information is determined, wherein the access indicator information is used to characterize the comparison between the number of valid access requests in the current time period and the number of valid access requests in the previous time period, and / or the comparison between the number of valid transmission control protocol connections in the current time period and the number of valid transmission control protocol connections in the previous time period;
[0099] Based on access metric information, containerized applications can be expanded or reduced in size.
[0100] In an exemplary embodiment of the present application, the processing module 630 may also be configured to:
[0101] Register access indicator information to the server application programming interface of the container service management platform;
[0102] Read access metrics information from the server API.
[0103] In an exemplary embodiment of the present application, the processing module 630 may implement expansion or reduction of the containerized application based on the access indicator information in the following manner:
[0104] When the access indicator information is the first access indicator information, the containerized application is expanded, wherein the first access indicator information is that the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period;
[0105] When the access indicator information is the second access indicator information, the containerized application is scaled down, wherein the second access indicator information is that the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period.
[0106] In an exemplary embodiment of the present application, the processing module 630 may implement capacity expansion processing for the containerized application in the following manner:
[0107] Increase the number of minimum work units of the container service management platform to achieve capacity expansion for containerized applications;
[0108] The processing module 630 can implement the scaling down of the containerized application in the following manner:
[0109] Reduce the number of minimum work units of the container service management platform to achieve scaling down of containerized applications.
[0110] In an exemplary embodiment of the present application, the protocol message may include a transmission control protocol and access device information; the parsing module 620 may parse the protocol message based on the proxy container in the container service management platform in the following manner:
[0111] Based on the proxy container, determining whether the transmission control protocol is a valid transmission control protocol;
[0112] In the case where the transmission control protocol is a valid transmission control protocol, determining whether the access device is a registered access device based on the access device information;
[0113] In the case where the access device is a registered access device, the access request corresponding to the protocol message is regarded as a valid access request;
[0114] The number of valid access requests and the number of valid transmission control protocol connections in the current time period are counted, and the number of valid access requests and the number of valid transmission control protocol connections in the current time period are used as the parsing result.
[0115] In an exemplary embodiment of the present application, the parsing module 620 may also be configured to:
[0116] When the access device is not a registered access device, stop responding to the access request corresponding to the protocol message.
[0117] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 730 and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740. The processor 710 can call the logic instructions in the memory 730 to execute the capacity control method of the containerized application, which is applied to the container service management platform based on the Kubernetes mechanism, and the containerized application is deployed on the container service management platform. The method includes: receiving the protocol message of the access request of the containerized application within the current time period; parsing the protocol message based on the proxy container of the container service management platform to obtain the parsing result, wherein the parsing result includes the number of valid access requests and\or the number of valid transmission control protocol connections, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that allows the proxy container to forward; based on the number of valid access requests and\or the number of valid transmission control protocol connections, the containerized application is expanded or reduced in capacity.
[0118] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0119] On the other hand, the present application also provides a computer program product, which includes a computer program, which can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the capacity control method of the containerized application provided by the above methods, which is applied to a container service management platform based on the Kubernetes mechanism, and the containerized application is deployed on the container service management platform. The method includes: receiving a protocol message of an access request of the containerized application within a current time period; parsing the protocol message based on a proxy container of the container service management platform to obtain a parsing result, wherein the parsing result includes a valid access request number and\or a valid transmission control protocol connection number, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; based on the valid access request number and\or the valid transmission control protocol connection number, the containerized application is expanded or reduced in capacity.
[0120] On the other hand, the present application also provides a computer-readable storage medium, the computer-readable storage medium includes a stored program, wherein the program executes the capacity control method of the containerized application provided by the above-mentioned methods when it is running, and is applied to a container service management platform based on the Kubernetes mechanism, and the containerized application is deployed on the container service management platform. The method includes: receiving a protocol message of an access request of the containerized application within a current time period; parsing the protocol message based on a proxy container of the container service management platform to obtain a parsing result, wherein the parsing result includes a valid access request number and\or a valid transmission control protocol connection number, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; based on the valid access request number and\or the valid transmission control protocol connection number, expanding or shrinking the containerized application.
[0121] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0122] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A capacity control method for containerized applications, It is characterized in that Applied to a container service management platform based on the Kubernetes mechanism, the container service management platform is deployed with the containerized application, and the method includes: receiving a protocol message of an access request of the containerized application within a current time period; Based on the proxy container of the container service management platform, the protocol message is parsed to obtain a parsing result, wherein the parsing result includes a valid access request number and / or a valid transmission control protocol connection number, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; Based on the number of valid access requests and / or the number of valid transmission control protocol connections, the containerized application is expanded or reduced in capacity.
2. The method for controlling the capacity of containerized applications according to claim 1, It is characterized in that The scaling up or down processing of the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections specifically includes: Based on the number of valid access requests and / or the number of valid transmission control protocol connections, access indicator information is determined, wherein the access indicator information is used to characterize the comparison between the number of valid access requests in the current time period and the number of valid access requests in the previous time period, and / or the comparison between the number of valid transmission control protocol connections in the current time period and the number of valid transmission control protocol connections in the previous time period; Based on the access indicator information, the containerized application is expanded or reduced in capacity.
3. The method for controlling the capacity of containerized applications according to claim 2, It is characterized in that Before the containerized application is expanded or reduced in capacity based on the access indicator information, the method further includes: Registering the access indicator information to the server application program interface of the container service management platform; The access indicator information is read from the server application program interface.
4. The capacity control method for containerized applications according to claim 2 or 3, It is characterized in that The scaling up or down processing of the containerized application based on the access indicator information specifically includes: In the case where the access indicator information is the first access indicator information, the containerized application is expanded, wherein the first access indicator information is that the number of valid access requests in the current time period is greater than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is greater than the number of valid transmission control protocol connections in the previous time period; In the case where the access indicator information is the second access indicator information, the containerized application is scaled down, wherein the second access indicator information is that the number of valid access requests in the current time period is less than the number of valid access requests in the previous time period, and\or the number of valid transmission control protocol connections in the current time period is less than the number of valid transmission control protocol connections in the previous time period.
5. The method for controlling the capacity of containerized applications according to claim 4, It is characterized in that The expansion of the containerized application is implemented in the following manner: Increasing the number of minimum working units of the container service management platform to achieve capacity expansion processing for the containerized application; The scaling down of the containerized application is implemented in the following manner: The number of minimum working units of the container service management platform is reduced to achieve scaling down of the containerized application.
6. The method for controlling the capacity of containerized applications according to claim 1, It is characterized in that The protocol message includes a transmission control protocol and access device information; the parsing of the protocol message based on the proxy container in the container service management platform specifically includes: Based on the proxy container, determining whether the transmission control protocol is the valid transmission control protocol; In a case where the transmission control protocol is the valid transmission control protocol, determining whether the access device is a registered access device based on the access device information; In the case where the access device is a registered access device, taking the access request corresponding to the protocol message as the valid access request; The number of valid access requests and the number of valid transmission control protocol connections in the current time period are counted, and the number of valid access requests and the number of valid transmission control protocol connections in the current time period are used as the parsing result.
7. The method for controlling the capacity of containerized applications according to claim 6, It is characterized in that After determining whether the access device is a registered access device based on the access device information, the method further includes: When the access device is not a registered access device, stop responding to the access request corresponding to the protocol message.
8. A capacity control device for containerized applications, It is characterized in that Applied to a container service management platform based on the Kubernetes mechanism, the container service management platform is deployed with the containerized application, and the device includes: A receiving module, configured to receive a protocol message of an access request of the containerized application within a current time period; A parsing module, configured to parse the protocol message based on the proxy container of the container service management platform to obtain a parsing result, wherein the parsing result includes a valid access request number and / or a valid transmission control protocol connection number, the valid access request is an access request that is allowed to be accessed, and the valid transmission control protocol is a transmission control protocol that is allowed to be forwarded by the proxy container; A processing module is used to expand or reduce the capacity of the containerized application based on the number of valid access requests and / or the number of valid transmission control protocol connections.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored program, wherein the program, when executed, executes the capacity control method for containerized applications according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, It is characterized in that The memory stores a computer program, and the processor is configured to execute the capacity control method for containerized applications according to any one of claims 1 to 7 through the computer program.