Resource optimization method and device, medium and product
By obtaining pressure stall information of hosts and containers in container cloud clusters and determining resource optimization strategies, the problem of inaccurate pressure judgment in the existing technology is solved, and more efficient service processing performance is achieved.
Patent Information
- Application Number
- CN202411824003.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-01
AI Technical Summary
The prior art is inaccurate in determining whether the pressure of the host/container in a container cloud cluster is too high, which affects the service processing performance.
Determine the pressure optimization strategy by obtaining resource waiting information for the target host and container, including the initial and final values of the pressure stall. The strategy includes deleting minimum performance containers or scaling high-load containers to optimize resource utilization.
Accurately judge the pressure of the host/container, optimize the service processing performance, and avoid performance degradation caused by excessive pressure.
Smart Images

Figure CN119739518A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a resource optimization method, device, medium and product. Background Art
[0002] In a container cloud cluster, multiple containers running on a host can rely on the operating system kernel and hardware resources provided by the host to run services. However, due to the uneven distribution of different hosts in the container cloud cluster and the uneven distribution of data and traffic of different containers on the host, some containers or hosts are overloaded, affecting their performance in processing services.
[0003] General technology can determine whether the pressure on the host / container is too high based on the hardware resources of the host / container (such as memory, etc.), and then perform relevant operations on the over-stressed host / container to improve its business processing performance.
[0004] However, the above method of judging whether the pressure of the host / container is too high based on the hardware resources of the host / container may be inaccurate, which may affect the service processing process of the host / container. Summary of the invention
[0005] The embodiments of the present disclosure provide a resource optimization method, device, medium, and product, which are intended to solve the technical problem that the common technology judges the pressure of the host / container inaccurately, thereby affecting the business processing process of the host / container.
[0006] In order to achieve the above objectives, this application adopts the following technical solutions:
[0007] In a first aspect, a resource optimization method is provided, including: obtaining resource waiting information of a target host and resource waiting information of each of a plurality of containers included in the target host; the resource waiting information of the target host includes a pressure stall initial value of the target host and a pressure stall final value of the target host; the pressure stall initial value is pressure stall information (PSI) corresponding to the target host at an initial moment; the pressure stall final value is the PSI corresponding to the target host at a current moment; and determining a target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the plurality of containers.
[0008] Optionally, a target resource optimization strategy is determined according to resource waiting information of the target host and / or resource waiting information of each of the multiple containers, including: determining whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host; when the pressure of the target host is greater than or equal to the first pressure threshold, determining that the target resource optimization strategy is a deletion strategy; the deletion strategy is used to delete at least one container; the at least one container is M containers with the smallest business processing performance among the multiple containers, where M is a positive integer.
[0009] Optionally, before determining that the target resource optimization strategy is a deletion strategy, the resource optimization method further includes: obtaining performance indicators of each of the multiple containers; wherein the performance indicator of a container is used to characterize the business processing performance of the container; and determining at least one container from the multiple containers based on the performance indicators of each of the multiple containers.
[0010] Optionally, the performance indicator of a container includes at least one of the following: a priority of the container, a resource usage of the container, a running time of the container, and a number of service replicas of the container.
[0011] Optionally, the performance indicator of a container includes a priority of the container and a resource occupancy of the container, and determining at least one container from the multiple containers according to the respective performance indicators of the multiple containers includes: when the respective priorities of the multiple containers are the same and the resource occupancy of the first container is different from the resource occupancy of the other containers, determining a container whose resource occupancy is greater than or equal to a resource occupancy threshold among the multiple containers as the at least one container; the first container is any one of the multiple containers.
[0012] Optionally, determining whether the pressure of the target host is greater than or equal to a first pressure threshold is performed based on the resource waiting information of the target host, including: when the pressure stall rate of the target host is greater than the first rate threshold, and / or the pressure stall final value is greater than the first value, determining that the pressure of the target host is greater than or equal to the first pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment.
[0013] Optionally, a target resource optimization strategy is determined based on resource waiting information of the target host and / or resource waiting information of each of the multiple containers, including: determining whether the pressure of the target host is less than a second pressure threshold based on the resource waiting information of the target host, and determining whether the pressure of each of the multiple containers is greater than a third pressure threshold based on the resource waiting information of each of the multiple containers; the second pressure threshold is less than the first pressure threshold; when the pressure of the target host is less than the second pressure threshold and the pressure of the first container is greater than the third pressure threshold, determining that the target resource optimization strategy is a capacity expansion strategy; the capacity expansion strategy is used to perform a capacity expansion operation on a first container; the first container is any one of the multiple containers.
[0014] Optionally, determining whether the pressure of the target host is less than a second pressure threshold based on the resource waiting information of the target host includes: when the pressure stall rate of the target host is less than or equal to the second rate threshold, and the pressure stall final value is less than or equal to the second numerical value, determining that the pressure of the target host is less than the second pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment; the second rate threshold is less than the first rate threshold; the second numerical value is less than the first numerical value.
[0015] In a second aspect, a resource optimization device is provided, which includes: a communication unit and a processing unit; the communication unit is used to obtain resource waiting information of a target host and resource waiting information of each of a plurality of containers included in the target host; the resource waiting information of the target host includes a pressure stall initial value of the target host and a pressure stall final value of the target host; the pressure stall initial value is a PSI corresponding to the target host at an initial moment; the pressure stall final value is a PSI corresponding to the target host at a current moment; the processing unit is used to determine a target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the plurality of containers.
[0016] Optionally, the processing unit is specifically used to: determine whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host; when the pressure of the target host is greater than or equal to the first pressure threshold, determine that the target resource optimization strategy is a deletion strategy; the deletion strategy is used to delete at least one container; the at least one container is M containers with the smallest business processing performance among multiple containers, and M is a positive integer.
[0017] Optionally, before determining that the target resource optimization strategy is the deletion strategy, the communication unit is further used to obtain performance indicators of each of the multiple containers; wherein the performance indicator of a container is used to characterize the business processing performance of the container; and the processing unit is further used to determine at least one container from the multiple containers according to the performance indicators of each of the multiple containers.
[0018] Optionally, the performance indicator of a container includes at least one of the following: a priority of the container, a resource usage of the container, a running time of the container, and a number of service replicas of the container.
[0019] Optionally, the performance indicator of a container includes a priority of the container and a resource occupancy of the container. The processing unit is specifically configured to: when the priorities of multiple containers are the same and the resource occupancy of a first container is different from the resource occupancy of other containers, determine a container whose resource occupancy is greater than or equal to a resource occupancy threshold among the multiple containers as at least one container; the first container is any one of the multiple containers.
[0020] Optionally, the processing unit is specifically used to: when the pressure stall rate of the target host is greater than a first rate threshold, and / or the pressure stall final value is greater than a first value, determine that the pressure of the target host is greater than or equal to a first pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment.
[0021] Optionally, the processing unit is specifically used to: determine whether the pressure of the target host is less than a second pressure threshold based on the resource waiting information of the target host, and determine whether the pressure of each of the multiple containers is greater than a third pressure threshold based on the resource waiting information of each of the multiple containers; the second pressure threshold is less than the first pressure threshold; when the pressure of the target host is less than the second pressure threshold and the pressure of the first container is greater than the third pressure threshold, determine that the target resource optimization strategy is a capacity expansion strategy; the capacity expansion strategy is used to perform a capacity expansion operation on the first container; the first container is any one of the multiple containers.
[0022] Optionally, the processing unit is specifically used to: determine that the pressure of the target host is less than the second pressure threshold when the pressure stall rate of the target host is less than or equal to the second rate threshold, and the pressure stall final value is less than or equal to the second numerical value; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment; the second rate threshold is less than the first rate threshold; the second numerical value is less than the first numerical value.
[0023] In a third aspect, a resource optimization device is provided, comprising a memory and a processor; the memory is used to store computer execution instructions, and the processor and the memory are connected via a bus; when the resource optimization device is running, the processor executes the computer execution instructions stored in the memory, so that the resource optimization device executes the resource optimization method of the first aspect.
[0024] The resource optimization device may be an electronic device or a part of an electronic device, such as a chip system in an electronic device. The chip system is used to support the electronic device to implement the functions involved in the first aspect and any possible implementation thereof, for example, to obtain and determine the data and / or information involved in the above-mentioned resource optimization method. The chip system includes a chip and may also include other discrete devices or circuit structures.
[0025] In a fourth aspect, a computer-readable storage medium is provided, the computer-readable storage medium comprising computer execution instructions, and when the computer execution instructions are executed on a computer, the computer executes the resource optimization method described in the first aspect.
[0026] In a fifth aspect, a computer program product is also provided. The computer program product includes a computer program or instructions. When the computer instructions are executed on a resource optimization device, the resource optimization device executes the resource optimization method as described in the first aspect above.
[0027] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium. The computer-readable storage medium may be packaged together with the processor of the resource optimization device, or may be packaged separately from the processor of the resource optimization device, which is not limited in the embodiments of the present application.
[0028] The description of the second, third, fourth and fifth aspects of the present application can refer to the detailed description of the first aspect.
[0029] In the embodiments of the present application, the name of the resource optimization device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. For example, the receiving unit may also be called a receiving module, a receiver, etc. As long as the functions of each device or functional module are similar to those of the present application, they fall within the scope of the claims of the present application and their equivalent technologies.
[0030] The technical solution provided by this application brings at least the following beneficial effects:
[0031] Based on any of the above aspects, an embodiment of the present application provides a resource optimization method, first, obtaining the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host. Then, according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers, determine the target resource optimization strategy. Among them, the resource waiting information of the target host includes the pressure stall initial value of the target host and the pressure stall final value of the target host. The pressure stall initial value is the PSI corresponding to the target host at the initial moment, and the pressure stall final value is the PSI corresponding to the target host at the current moment.
[0032] As can be seen from the above, the present application can obtain the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host. Among them, the resource waiting information of the target host includes the pressure stall information of the host, and correspondingly, the resource waiting information of the container includes the pressure stall information of the container. The pressure of the host can be accurately determined based on the pressure stall information of the host, and correspondingly, the pressure of the container can be accurately determined based on the pressure stall information of the container. The present application can determine the target resource optimization strategy based on the resource waiting information of the target host, and / or the resource waiting information of each of the multiple containers included in the target host. Therefore, the present application can accurately determine whether the pressure of the host / container is too large to optimize the business processing process of the host / container.
[0033] The beneficial effects of the first, second, third, fourth and fifth aspects of the present application can all be referred to the analysis of the above beneficial effects, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of the structure of a resource optimization system provided in an embodiment of the present application;
[0035] Figure 2 A schematic diagram of a hardware structure of a communication device provided in an embodiment of the present application;
[0036] Figure 3 A schematic diagram of a process flow of a resource optimization method provided in an embodiment of the present application;
[0037] Figure 4 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0038] Figure 5 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0039] Figure 6 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0040] Figure 7 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0041] Figure 8 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0042] Fig. 9 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0043] Fig.10 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0044] Fig.11 A flowchart of another resource optimization method provided in an embodiment of the present application;
[0045] Fig.12 A schematic diagram of the structure of a resource optimization device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 are within the scope of protection of this application.
[0047] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0048] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. are not limiting the quantity and execution order.
[0049] Before introducing the resource optimization method provided by this application in detail, a brief introduction to the application scenarios and implementation environment involved in this application is first given.
[0050] First, a brief introduction to the application scenarios involved in this application is given.
[0051] As described in the background technology, in a container cloud cluster, multiple containers running on a host can rely on the operating system kernel and hardware resources provided by the host to run services. However, due to the uneven distribution of different hosts in the container cloud cluster and the uneven distribution of data and traffic of different containers on the host, some containers or some hosts are overloaded, resulting in hot spots in the host / container, affecting its performance in processing services.
[0052] General technology can determine whether the pressure on the host / container is too high based on the hardware resources of the host / container (for example, central processing unit (CPU), memory), and then perform relevant operations on the over-stressed host / container to improve its business processing performance.
[0053] For example, when the pressure on the container is too high and hot spots are generated in the container, the general technology can be based on horizontal automatic expansion and contraction (Horizontal Pod Autoscaler, HPA), increasing (also called expanding) the number of container implementations to improve the performance of container processing services.
[0054] As another example, when the pressure on the host is too great and a hotspot is generated on the host, a general technology can evict (also referred to as delete) all containers on the host.
[0055] The general technology determines the pressure of the host / container based on the CPU and memory of the host / container, which cannot accurately reflect the pressure of the host / container and its performance in processing services. In addition, when the pressure on the container is too high and hot spots are generated in the container, the general technology needs to be based on the application's interface and business performance indicators when scaling the container based on HPA, which is not universal. In addition, the general technology is only applicable to applications (i.e., stateless applications) where increasing the number of container implementations has no effect on task operation, so the general technology has limitations. When the pressure on the host is too high and hot spots are generated in the host, the general technology is to make manual judgments and execute the operation of expelling all containers, which lacks flexibility.
[0056] Therefore, the above method of judging whether the pressure of the host / container is too high based on the hardware resources of the host / container may be inaccurate, which will affect the business processing of the host / container.
[0057] The embodiment of the present application provides a resource optimization method, first, obtaining the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host. Then, according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers, the target resource optimization strategy is determined. Among them, the resource waiting information of the target host includes the pressure stall initial value of the target host and the pressure stall final value of the target host. The pressure stall initial value is the PSI corresponding to the target host at the initial moment, and the pressure stall final value is the PSI corresponding to the target host at the current moment.
[0058] As can be seen from the above, the present application can obtain the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host. Among them, the resource waiting information of the target host includes the pressure stall information of the host, and correspondingly, the resource waiting information of the container includes the pressure stall information of the container. The pressure of the host can be accurately determined based on the pressure stall information of the host, and correspondingly, the pressure of the container can be accurately determined based on the pressure stall information of the container. The present application can determine the target resource optimization strategy based on the resource waiting information of the target host, and / or the resource waiting information of each of the multiple containers included in the target host. Therefore, the present application can accurately determine whether the pressure of the host / container is too large to optimize the business processing process of the host / container.
[0059] The implementation environment of the above resource optimization method can be the resource optimization system provided in the embodiment of the present application.
[0060] Figure 1 FIG. 1 shows a schematic diagram of the structure of the resource optimization system provided in the embodiment of the present application. Figure 1 As shown, the resource optimization system includes: a resource optimization device 101, a data acquisition device 102, and a data storage device 103.
[0061] The resource optimization device 101 is respectively connected to the data collection device 102 and the data storage device 103 for communication. The data collection device 102 and the data storage device 103 are respectively connected to each other for communication.
[0062] In practical applications, the resource optimization device 101 can be connected to any number of data collection devices 102. For ease of understanding, Figure 1 An example of a resource optimization device 101 connected to a data acquisition device 102 is used for description.
[0063] In one achievable manner, the resource optimization device 101 includes: an event generation module (also referred to as an event generator), an event reception and processing module (also referred to as an event reception and processor), an event synchronization module (also referred to as an event synchronizer) and a gateway server.
[0064] The event generation module is used to periodically check the PSI and determine the events related to the host hotspot and the container hotspot, that is, to determine the occurrence of events.
[0065] The event receiving and processing module is used to process events related to hotspots, determine resource optimization strategies, and trigger the execution of the event synchronization module.
[0066] The event synchronization module is used to synchronize the target resource optimization strategy to the gateway server, or directly execute the target resource optimization strategy.
[0067] The gateway server is used to execute the target resource optimization strategy.
[0068] In the embodiment of the present application, the data collection device 102 is used to collect the PSI of the host and / or the PSI of the container.
[0069] The data storage device 103 is used to store the PSI of the host and / or the PSI of the container.
[0070] Optionally, the data storage device 103 may be a time series database.
[0071] A time series database is a database management system specifically designed to process time-tagged data. Time series data is data that changes in chronological order, i.e., time-serialized data, also known as timestamp data.
[0072] Optionally, the physical device of the resource optimization device 101 may be a server, a terminal, or other types of electronic devices, which is not limited in the embodiments of the present application.
[0073] Optionally, the terminal may be a device that provides voice and / or data connectivity to a user, a handheld device with wireless connection function, or other processing device connected to a wireless modem. The wireless terminal may communicate with one or more core networks via a radio access network (RAN). The wireless terminal may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, or a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device that exchanges language and / or data with a radio access network, such as a mobile phone, tablet computer, laptop computer, netbook, personal digital assistant (PDA).
[0074] Optionally, the above-mentioned server can be a server in a server cluster (consisting of multiple servers), or a chip in the server, or a system on a chip in the server, or can be implemented by a virtual machine (VM) deployed on a physical machine, which is not limited in the embodiments of the present application.
[0075] Optionally, the resource optimization device 101 and the data collection device 102 may be two devices independently set up, or may be integrated into the same device. When the resource optimization device 101 and the data collection device 102 are integrated into the same device, the data collection device 102 may be a communication module of the resource optimization device 101 .
[0076] Optionally, the resource optimization device 101 and the data storage device 103 may be two devices independently set up, or may be integrated into the same device. When the resource optimization device 101 and the data storage device 103 are integrated into the same device, the data storage device 103 may be a storage module (e.g., a database) of the resource optimization device 101.
[0077] It is easy to understand that when the resource optimization device 101 and the data acquisition device 102 are integrated into the same device, the communication mode between the resource optimization device 101 and the data acquisition device 102 is the communication between the internal modules of the device. In this case, the communication process between the two is the same as the communication process between the resource optimization device 101 and the data acquisition device 102 when they are independent of each other.
[0078] It is easy to understand that when the resource optimization device 101 and the data storage device 103 are integrated into the same device, the communication mode between the resource optimization device 101 and the data storage device 103 is the communication between the internal modules of the device. In this case, the communication process between the two is the same as the communication process between the resource optimization device 101 and the data storage device 103 when they are independent of each other.
[0079] For ease of understanding, the present application is explained by taking the example that the resource optimization device 101 and the data acquisition device 102 are independent of each other, and the resource optimization device 101 and the data storage device 103 are independent of each other.
[0080] The resource optimization devices in the resource optimization system include: Figure 2 The following are the components included. Figure 2 Taking the communication device shown as an example, the hardware structure of the resource optimization device is introduced.
[0081] Figure 2 , which is a schematic diagram of a hardware structure of a communication device provided in an embodiment of the present application. The communication device includes a processor 21, a memory 22, a communication interface 23, and a bus 24. The processor 21, the memory 22, and the communication interface 23 can be connected via a bus 24.
[0082] The processor 21 is the control center of the communication device, which can be a processor or a general term for multiple processing elements. For example, the processor 21 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0083] As an embodiment, the processor 21 may include one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in the figure.
[0084] The memory 22 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0085] In a possible implementation, the memory 22 may exist independently of the processor 21, and the memory 22 may be connected to the processor 21 via a bus 24 to store instructions or program codes. When the processor 21 calls and executes the instructions or program codes stored in the memory 22, the resource optimization method provided in the following embodiments of the present application can be implemented.
[0086] In the embodiment of the present application, for the communication device, the software programs stored in the memory 22 are different, so the functions implemented by the communication device are different. The functions performed by each device will be described in conjunction with the following flowchart.
[0087] In another possible implementation, the memory 22 may also be integrated with the processor 21 .
[0088] The communication interface 23 is used for the communication device to connect with other devices through a communication network, and the communication network may be Ethernet, wireless access network, wireless local area network (WLAN), etc. The communication interface 23 may include a receiving unit for receiving data and a sending unit for sending data.
[0089] The bus 24 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0090] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the communication device, except Figure 2 In addition to the components shown, the communication device may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0091] The resource optimization method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0092] The resource optimization method provided in the embodiment of the present application is applied to Figure 1 The resource optimization device 101 in the resource optimization system shown in FIG. Figure 3 As shown, the resource optimization method provided in the embodiment of the present application includes:
[0093] S301: Obtain resource waiting information of a target host and resource waiting information of each of a plurality of containers included in the target host.
[0094] The resource waiting information of the target host includes a pressure stall initial value of the target host and a pressure stall final value of the target host.
[0095] The pressure stall initial value is the PSI corresponding to the target host at the initial moment.
[0096] The pressure stall final value is the PSI corresponding to the target host at the current moment.
[0097] In one achievable manner, the resource optimization device can obtain the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host. In this way, the resource optimization device can accurately determine whether the pressure of the host / container is too large. The target resource optimization strategy can be determined based on the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers.
[0098] The resource waiting information of a container includes an initial pressure stall value of the container and a final pressure stall value of the container.
[0099] The initial value of the pressure stall of the container is the PSI corresponding to the container at the initial moment.
[0100] The final pressure stall value of the container is the PSI corresponding to the container at the current moment.
[0101] It should be understood that the PSI corresponding to a container at the initial moment is the waiting time for the container to apply for hardware resources (for example, CPU, memory) at the initial moment. As a stress benchmark data, PSI can accurately reflect the usage of hardware resources and whether hot spots appear in the host or container.
[0102] Optionally, the PSI corresponding to the above-mentioned target host at the initial moment may include the PSI corresponding to the CPU of the target host at the initial moment and the PSI corresponding to the memory of the target host at the initial moment, and the PSI corresponding to the target host at the current moment may include the PSI corresponding to the CPU of the target host at the current moment and the PSI corresponding to the memory of the target host at the current moment.
[0103] Optionally, the resource waiting information of the target host may further include: CPU utilization of the target host and memory utilization of the target host.
[0104] Optionally, the PSI corresponding to the above-mentioned container at the initial moment may include the PSI corresponding to the CPU of the container at the initial moment and the PSI corresponding to the memory of the container at the initial moment, and the PSI corresponding to the container at the current moment may include the PSI corresponding to the CPU of the container at the current moment and the PSI corresponding to the memory of the container at the current moment.
[0105] Optionally, the resource waiting information of the container may further include: CPU utilization of the container, memory utilization of the container, container name, and name of the target host (also referred to as the container host name).
[0106] Combination Figure 1 The data collection device can obtain the resource waiting information of the host and the resource waiting information of each of the multiple containers included in the target host.
[0107] In one practicable manner, the data collection device may use a collection program in the target host to obtain the resource waiting information of the target host and the resource waiting information of each of the above-mentioned multiple containers through the file path corresponding to the PSI.
[0108] Optionally, the file path of resource waiting information of a host (such as a target host) may be: / proc / pressure / . The file path of resource waiting information of a container may be: / sys / fs / cgroup / .
[0109] Combination Figure 1 The data collection device can send the resource waiting information of the host and the resource waiting information of each of the multiple containers included in the target host to the data storage device. Correspondingly, the data storage device can store the resource waiting information of the host and the resource waiting information of each of the multiple containers included in the target host sent by the data collection device.
[0110] S302: Determine a target resource optimization strategy according to resource waiting information of a target host and / or resource waiting information of each of a plurality of containers.
[0111] In the embodiment of the present application, since the resource waiting information of the target host includes the PSI corresponding to the target host at the initial moment (i.e., the initial value of the pressure stall of the target host) and the PSI corresponding to the target host at the current moment (i.e., the final value of the pressure stall of the target host), the resource waiting information of a container includes the PSI corresponding to the container at the initial moment (i.e., the initial value of the pressure stall of the container) and the PSI corresponding to the container at the current moment (i.e., the final value of the pressure stall of the container). These PSIs can directly and effectively reflect the business processing performance of the target host and multiple containers. In this way, the resource optimization device can accurately and flexibly determine the target resource optimization strategy based on the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers, thereby improving the business processing capabilities of the target host and / or multiple containers.
[0112] Optionally, the resource optimization device may determine whether a hotspot occurs in the target host according to resource waiting information of the target host, and may determine whether a hotspot occurs in the container according to resource waiting information of each of the multiple containers.
[0113] It can be understood that the above hot spots are used to indicate whether the target host and multiple containers are overloaded.
[0114] In some embodiments, in combination Figure 3 ,like Figure 4 As shown, in S302, according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers, a target resource optimization strategy is determined, which specifically includes:
[0115] S401 . Determine whether the pressure of the target host is greater than or equal to a first pressure threshold according to resource waiting information of the target host.
[0116] In one practicable manner, the resource optimization device may determine whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host, so as to determine the optimization strategy of the target resource according to the pressure of the target host.
[0117] The resource optimization device may determine whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host.
[0118] S402: When the pressure of the target host is greater than or equal to a first pressure threshold, determine that the target resource optimization strategy is a deletion strategy.
[0119] The deletion policy is used to delete at least one container.
[0120] The at least one container is M containers with the smallest service processing performance among the multiple containers, where M is a positive integer.
[0121] In one achievable manner, when the pressure of the target host is greater than or equal to the first pressure threshold, the resource optimization device may determine that the target resource optimization policy is a deletion policy. The deletion policy is used to delete at least one container. In this way, the resource optimization device may delete the container to optimize the performance of the host and container processing services.
[0122] When the pressure of the target host is greater than or equal to the first pressure threshold, it means that the pressure of the target host is too high (it can also be understood as a hot spot on the target host). At this time, the resource optimization device can determine that the target resource optimization strategy is a deletion strategy, specifically deleting at least one of the above containers to release the hardware resources of the target host, which can improve the business processing performance of the target host.
[0123] In some embodiments, in combination Figure 4 ,like Figure 5 As shown, before determining that the target resource optimization strategy is a deletion strategy, the resource optimization method further includes:
[0124] S501. Obtain performance indicators of multiple containers.
[0125] Among them, the performance indicator of a container is used to characterize the business processing performance of the container.
[0126] S502: Determine at least one container from the multiple containers according to respective performance indicators of the multiple containers.
[0127] In combination with the description of the above embodiment, it should be understood that since at least one container is the M containers with the smallest business processing performance among multiple containers, and the performance index of a container is used to characterize the business processing performance of the container. In this way, the resource optimization device can determine the M containers with the smallest (or worst) business processing performance from multiple containers according to the performance indicators of each of the multiple containers, that is, determine the above at least one container. Furthermore, the resource optimization device can delete the container with poor business processing performance, thereby improving the business processing performance of the target host.
[0128] In an optional implementation, the resource optimization device may directly obtain the performance indicators of each of the multiple containers.
[0129] In another optional implementation, the above Figure 1 The data collection device 102 shown in the figure collects the performance indicators of each of the multiple containers and sends the performance indicators of each of the multiple containers to the resource optimization device, so that the resource optimization device can obtain the performance indicators of each of the multiple containers.
[0130] In some embodiments, the performance indicator of a container includes at least one of the following: a priority of the container, a resource usage of the container, a running time of the container, and a number of service replicas of the container.
[0131] It should be understood that the priority of a container can be a high priority or a low priority. The priority of the container can represent the importance of the container and / or the selection order of the container.
[0132] The resource usage of a container refers to the size of the hardware resources (such as CPU and memory) occupied by the container during operation.
[0133] The running time of a container is the length of time from the start to the stop of the container. When the hardware resources of the target host are insufficient, the container included in the target host may fail and stop running.
[0134] The number of service replicas of a container refers to the number of identical container embodiments included in the container. A container embodiment is used to characterize the operations performed by the container. The service replicas in the container can improve the service availability, performance, and fault tolerance of the container.
[0135] In an optional implementation, a performance indicator of a container may include a priority of the container, and the resource optimization device determines at least one container from the multiple containers according to the respective performance indicators of the multiple containers, specifically including:
[0136] When the priority of the first container is different from the priorities of the other containers, the resource optimization device determines a container whose priority is less than or equal to the priority threshold among the multiple containers as at least one container.
[0137] The first container is any one of the above-mentioned multiple containers.
[0138] Optionally, the performance indicator of a container may also include the running time of the container. The resource optimization device determines at least one container from the multiple containers according to the respective performance indicators of the multiple containers, specifically including:
[0139] When the running time of the first container is different from the running time of other containers, the resource optimization device determines a container whose running time among the multiple containers is less than or equal to the running time threshold as at least one container.
[0140] Optionally, the performance indicator of a container includes the number of service copies of the container, and the resource optimization device determines at least one container from the multiple containers according to the respective performance indicators of the multiple containers, specifically including:
[0141] When the number of service copies of the first container is different from the number of service copies of other containers, the resource optimization device determines a container whose number of service copies among the multiple containers is greater than or equal to a threshold value of the number of service copies as at least one container.
[0142] Optionally, the importance of the above-mentioned multiple performance indicators may be different. For example, the importance of the above-mentioned multiple performance indicators is from high to low: the priority of the container, the resource usage of the container, the running time of the container, and the number of service copies of the container. The resource optimization device can determine the above-mentioned at least one container based on the performance indicators of each of the multiple containers and the importance of the multiple performance indicators.
[0143] In some embodiments, a performance indicator of a container includes a priority of the container and a resource occupancy amount of the container, and the resource optimization device determines at least one container from the multiple containers according to the respective performance indicators of the multiple containers, specifically including:
[0144] When the priorities of the multiple containers are the same and the resource occupation of the first container is different from the resource occupation of the other containers, the resource optimization device determines a container whose resource occupation is greater than or equal to the resource occupation threshold among the multiple containers as at least one container.
[0145] The first container is any one of the plurality of containers.
[0146] In some other embodiments, the performance indicator of a container includes a priority of the container, a resource usage of the container, and a running time of the container. The resource optimization device determines at least one container from the multiple containers according to the performance indicators of the multiple containers, specifically including:
[0147] When the priorities of the multiple containers are the same, the resource occupancy of the multiple containers is the same, and the running time of the first container is different from the running time of the other containers, the resource optimization device determines the container whose running time is less than or equal to the running time threshold among the multiple containers as at least one container.
[0148] Optionally, the resource optimization device may obtain events of each of the above-mentioned multiple containers. If the events of a certain container include events related to the host hotspot, the resource optimization device may delete the container until the events related to the host hotspot no longer occur.
[0149] In some embodiments, in combination Figure 5 ,like Figure 6 As shown, in S401, determining whether the pressure of the target host is greater than or equal to the first pressure threshold according to the resource waiting information of the target host specifically includes:
[0150] S601: When the pressure stall rate of the target host is greater than a first rate threshold, and / or the pressure stall final value of the target host is greater than a first value, determine that the pressure of the target host is greater than or equal to a first pressure threshold.
[0151] The pressure stall rate is the ratio between the second difference and the first difference.
[0152] The second difference is the difference between the pressure stall final value and the pressure stall initial value.
[0153] The first difference is the difference between the current time and the initial time.
[0154] In one achievable method, when the pressure stall rate of the target host is greater than a first rate threshold, and / or the pressure stall final value is greater than a first value, it indicates that the PSI of the target host changes rapidly from an initial moment to a current moment, and that the PSI corresponding to the target host at the current moment is larger, that is, the pressure of the target host is larger. In this way, the resource optimization device can accurately and effectively determine that the pressure of the target host is greater than or equal to the first pressure threshold.
[0155] Optionally, when the pressure of the target host is greater than or equal to a first pressure threshold, the resource optimization device may determine that the target host is under high pressure.
[0156] Optionally, the pressure stall rate may also be referred to as full_rate, and the pressure stall final value may also be referred to as full_avg10.
[0157] Exemplarily, the first rate threshold may be 5 Pascal (Pa) / s, and the first value may be 80 Pa.
[0158] The pressure stall rate is the ratio of the second difference to the first difference. The second difference is the difference between the pressure stall final value and the pressure stall initial value. The first difference is the difference between the current moment and the initial moment.
[0159] The resource optimization device may determine the difference between the current time and the initial time as the first difference.
[0160] Optionally, the data collection device may periodically obtain the resource waiting information of the host and the resource waiting information of the container.
[0161] Exemplarily, the collection period (also referred to as sampling interval) of the data collection device is usually 30 seconds.
[0162] The data acquisition device reads the resource waiting information at time t and records it as full_total_start. The data acquisition device reads the resource waiting information at time t+interval and records it as full_total_end.
[0163] Specifically, the resource optimization device may determine the difference between the current moment and the initial moment as the first difference, and determine the difference between the pressure stall final value and the pressure stall initial value as the second difference. Finally, the ratio between the second difference and the first difference is determined as the pressure stall rate of the target container (also referred to as the rate of change of the full_total value within the time interval interval).
[0164] The pressure stall rate can satisfy the following formula:
[0165] full_rate=(full_total_end-full_total_start) / interval;
[0166] Among them, full_total_end is used to indicate the final value of pressure stall, full_total_start is used to indicate the initial value of pressure stall, and interval is used to indicate the first difference.
[0167] In the embodiment of the present application, the pressure of the target host may include the CPU pressure of the target host and the memory pressure of the target host. The specific process of the resource optimization device determining the CPU pressure of the target host and the memory pressure of the target host is the same or similar to the explanation of the resource optimization device determining the pressure of the target host, and will not be repeated here.
[0168] In some embodiments, in combination Figure 6 ,like Figure 7 As shown, in S302, according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers, a target resource optimization strategy is determined, which specifically includes:
[0169] S701. Determine whether the pressure of the target host is less than a second pressure threshold according to the resource waiting information of the target host, and determine whether the pressure of each of the multiple containers is greater than a third pressure threshold according to the resource waiting information of each of the multiple containers.
[0170] The second pressure threshold is less than the first pressure threshold.
[0171] In one achievable manner, the resource optimization device can determine whether the pressure of the target host is less than the second pressure threshold according to the resource waiting information of the target host, and determine whether the pressure of each of the multiple containers is greater than the third pressure threshold according to the resource waiting information of each of the multiple containers, so as to accurately and flexibly determine the target resource optimization strategy.
[0172] The resource optimization device may determine whether the pressure of the target host is less than the second pressure threshold according to the resource waiting information of the target host, and determine whether the pressure of each of the multiple containers is greater than the third pressure threshold according to the resource waiting information of each of the multiple containers.
[0173] In one possible implementation, the resource optimization device may refer to Figure 6 The embodiment described determines the pressure of the container and will not be described in detail here.
[0174] S702: When the pressure of the target host is less than the second pressure threshold and the pressure of the first container is greater than the third pressure threshold, determine that the target resource optimization strategy is a capacity expansion strategy.
[0175] The capacity expansion strategy is used to perform a capacity expansion operation on the first container.
[0176] The first container is any one of the plurality of containers.
[0177] In one achievable manner, when the pressure of the target host is less than the second pressure threshold, and the pressure of the first container is greater than the third pressure threshold, it indicates that the PSI of the target host changes slowly from the initial moment to the current moment, and the PSI corresponding to the target host at the current moment is smaller, that is, the pressure of the target host is smaller, but the pressure of the first container is larger. At this time, the resource optimization device can determine that the target resource optimization strategy is a capacity expansion strategy, specifically, performing a capacity expansion operation on the above-mentioned first container to increase the CPU / memory of the first container, which can improve the business processing capacity of the target container.
[0178] The expansion strategy refers to adjusting the control group (cgroup) corresponding to the container, including temporarily increasing the container CPU and temporarily increasing the container's memory limit.
[0179] Specifically, when the resource optimization device adjusts the cgroup corresponding to the container, the resource optimization device can increase the container CPU / memory by a preset multiple and obtain the frequency of the event. If the frequency of the event remains unchanged or increases, the resource optimization device can increase the container CPU / memory by a preset multiple until the event does not occur.
[0180] Exemplarily, the preset multiple may be 0.1 times.
[0181] In some embodiments, in combination Figure 7 ,like Figure 8 As shown, in S701, determining whether the pressure of the target host is less than the second pressure threshold according to the resource waiting information of the target host specifically includes:
[0182] S801: When the pressure stall rate of the target host is less than or equal to a second rate threshold, and the pressure stall final value is less than or equal to a second value, determine that the pressure of the target host is less than a second pressure threshold.
[0183] The pressure stall rate is the ratio between the second difference and the first difference.
[0184] The second difference is the difference between the pressure stall final value and the pressure stall initial value.
[0185] The first difference is the difference between the current time and the initial time.
[0186] The second rate threshold is less than the first rate threshold, and the second value is less than the first value. In one achievable manner, when the pressure stall rate of the target host is less than or equal to the second rate threshold, and the pressure stall final value is less than or equal to the second value, it indicates that the PSI of the target host changes slowly from the initial moment to the current moment, and the PSI corresponding to the target host at the current moment is smaller, that is, the pressure of the target host is smaller, so that the resource optimization device can accurately and effectively determine that the pressure of the target host is less than the second pressure threshold.
[0187] Optionally, when the pressure of the target host is less than a second pressure threshold, the resource optimization device may determine that the target host is under low pressure.
[0188] Exemplarily, the second rate threshold may be 1 Pa / s, and the second value may be 50 Pa.
[0189] In one achievable way, Fig. 9 A schematic diagram of another resource optimization process provided in an embodiment of the present application is shown.
[0190] First, the data acquisition device obtains the PSI file of the host and the PSI file of the container based on the host-side acquisition program.
[0191] The PSI file of the host includes: CPU pressure, memory pressure and input / output (IO) pressure. The PSI file of the container includes: CPU pressure and memory pressure.
[0192] Then, the data acquisition device stores the acquired PSI file of the host and the PSI file of the container to a data storage device (referred to as storage).
[0193] Next, the event generation module in the resource optimization device obtains the PSI file of the host and the PSI file of the container from the data storage device, and the event generation module in the resource optimization device communicates with the gateway server (also called the interface gateway server) in the resource optimization device, so that the gateway server executes the resource optimization strategy.
[0194] Specifically, first, the event generation module is used to determine the events related to the host hotspot and the events related to the container hotspot based on the PSI file of the host and the PSI file of the container. Then, the event receiving and processing module processes the events related to the hotspot (including: events related to the host hotspot and events related to the container hotspot) and determines the resource optimization strategy. Then, the event synchronization module synchronizes the target resource optimization strategy to the gateway server, or directly executes the target resource optimization strategy. Then, the gateway server is used to execute the target resource optimization strategy.
[0195] In the resource optimization device, the controller program can drive the gateway server to execute the target resource optimization strategy.
[0196] If hot spots occur in the container, adjust the cgroup file of the container.
[0197] Specifically, the gateway server adjusts the cgroup file of the container based on open source executor programs such as kubelet and container runtime programs such as containerization platforms (docker).
[0198] In case of hotspot on the host, delete at least one container.
[0199] Specifically, the gateway server deletes the container based on the execution program on the host side.
[0200] For example, Fig.10 A schematic diagram of another resource optimization process provided in an embodiment of the present application is shown.
[0201] The resource optimization device also includes a buffer and an executor.
[0202] The event synchronization module, the event receiving and processing module, the buffer, and the gateway server are connected in communication in sequence. The event synchronization module is connected in communication with the gateway server, and the event receiving and processing module is connected in communication with the executor.
[0203] In the process of determining the resource optimization strategy by the resource optimization device, the event receiving and processing module receives events related to hotspots from the storage device and processes the events related to hotspots to determine the resource optimization strategy. The event synchronization module synchronizes the target resource optimization strategy to the gateway server or directly executes the target resource optimization strategy.
[0204] Optionally, the event receiving and processing module can directly drive the executor to execute the resource optimization strategy.
[0205] For example, Fig.11 A schematic diagram of another resource optimization process provided in an embodiment of the present application is shown.
[0206] First, the data acquisition device acquires the PSI file of the host and the PSI file of the container based on the storage client program, and sends them to the event generation module.
[0207] Then, the event generation module is used to determine the events related to the host hotspot and the events related to the container hotspot based on the PSI file of the host and the PSI file of the container.
[0208] Next, the event generation module broadcasts the event and pushes the event to the gateway server.
[0209] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0210] The embodiment of the present application can divide the resource optimization device into functional modules according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. Optionally, the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0211] Fig.12 FIG. 1 is a schematic diagram showing the structure of a resource optimization device provided in an embodiment of the present application. Fig.12 As shown, the resource optimization device includes: a communication unit 1201 and a processing unit 1202;
[0212] The communication unit 1201 is used to obtain the resource waiting information of the target host and the resource waiting information of each of the multiple containers included in the target host; the resource waiting information of the target host includes the pressure stall initial value of the target host and the pressure stall final value of the target host; the pressure stall initial value is the PSI corresponding to the target host at the initial moment; the pressure stall final value is the PSI corresponding to the target host at the current moment; the processing unit 1202 is used to determine the target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers.
[0213] Optionally, the processing unit 1202 is specifically used to: determine whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host; when the pressure of the target host is greater than or equal to the first pressure threshold, determine that the target resource optimization strategy is a deletion strategy; the deletion strategy is used to delete at least one container; the at least one container is M containers with the smallest business processing performance among multiple containers, and M is a positive integer.
[0214] Optionally, before determining that the target resource optimization strategy is the deletion strategy, the communication unit 1201 is also used to obtain performance indicators of multiple containers respectively; wherein the performance indicator of a container is used to characterize the business processing performance of the container; the processing unit 1202 is also used to determine at least one container from the multiple containers according to the performance indicators of the multiple containers respectively.
[0215] Optionally, the performance indicator of a container includes at least one of the following: a priority of the container, a resource usage of the container, a running time of the container, and a number of service replicas of the container.
[0216] Optionally, the performance indicator of a container includes a priority of the container and a resource occupancy of the container. The processing unit 1202 is specifically configured to: when the priorities of multiple containers are the same and the resource occupancy of a first container is different from the resource occupancy of other containers, determine a container whose resource occupancy is greater than or equal to a resource occupancy threshold among the multiple containers as at least one container; the first container is any one of the multiple containers.
[0217] Optionally, the processing unit 1202 is specifically used to: when the pressure stall rate of the target host is greater than a first rate threshold, and / or the pressure stall final value is greater than a first value, determine that the pressure of the target host is greater than or equal to a first pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment.
[0218] Optionally, the processing unit 1202 is specifically used to: determine whether the pressure of the target host is less than a second pressure threshold based on the resource waiting information of the target host, and determine whether the pressure of each of the multiple containers is greater than a third pressure threshold based on the resource waiting information of each of the multiple containers; the second pressure threshold is less than the first pressure threshold; when the pressure of the target host is less than the second pressure threshold, and the pressure of the first container is greater than the third pressure threshold, determine that the target resource optimization strategy is a capacity expansion strategy; the capacity expansion strategy is used to perform a capacity expansion operation on the first container; the first container is any one of the multiple containers.
[0219] Optionally, the processing unit 1202 is specifically used to: determine that the pressure of the target host is less than the second pressure threshold when the pressure stall rate of the target host is less than or equal to the second rate threshold, and the pressure stall final value is less than or equal to the second numerical value; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment; the second rate threshold is less than the first rate threshold; the second numerical value is less than the first numerical value.
[0220] An embodiment of the present application further provides a computer-readable storage medium, which includes computer-executable instructions. When the computer-executable instructions are executed on a computer, the computer executes the resource optimization method provided in the above embodiment.
[0221] An embodiment of the present application also provides a computer program, which can be directly loaded into a memory and contains software code. After being loaded and executed by a computer, the computer program can implement the resource optimization method provided in the above embodiment.
[0222] Those skilled in the art should be aware that in one or more of the above examples, the functions described in this application can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. Storage media can be any available media that can be accessed by general or special-purpose computers.
[0223] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0224] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0225] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the general technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) 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 U disk, a mobile hard disk, a ROM, a RAM, a disk, or an optical disk.
[0226] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A resource optimization method, characterized in that: include: Obtain resource waiting information of a target host and resource waiting information of each of a plurality of containers included in the target host; The resource waiting information of the target host includes the pressure stall initial value of the target host and the pressure stall final value of the target host; the pressure stall initial value is the pressure stall information PSI corresponding to the target host at the initial moment; the pressure stall final value is the PSI corresponding to the target host at the current moment; A target resource optimization strategy is determined according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers.
2. The method according to claim 1, characterized in that Determining a target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers includes: Determining whether the pressure of the target host is greater than or equal to a first pressure threshold according to the resource waiting information of the target host; When the pressure of the target host is greater than or equal to the first pressure threshold, it is determined that the target resource optimization strategy is a deletion strategy; the deletion strategy is used to delete at least one container; the at least one container is M containers with the smallest business processing performance among the multiple containers, where M is a positive integer.
3. The method according to claim 2, characterized in that Before determining that the target resource optimization strategy is a deletion strategy, the method further includes: Acquire performance indicators of each of the multiple containers; wherein the performance indicator of a container is used to characterize the business processing performance of the container; The at least one container is determined from the multiple containers according to the respective performance indicators of the multiple containers.
4. The method according to claim 3, characterized in that The performance indicator of a container includes at least one of the following: the priority of the container, the resource usage of the container, the running time of the container, and the number of service replicas of the container.
5. The method according to claim 3, characterized in that: The performance indicator of a container includes a priority of the container and a resource occupancy amount of the container, and determining the at least one container from the multiple containers according to the respective performance indicators of the multiple containers includes: When the priorities of the multiple containers are the same and the resource occupation of the first container is different from the resource occupation of the other containers, a container whose resource occupation is greater than or equal to the resource occupation threshold among the multiple containers is determined as the at least one container; and the first container is any one of the multiple containers.
6. The method according to any one of claims 2 to 5, characterized in that: The determining, according to the resource waiting information of the target host, whether the pressure of the target host is greater than or equal to a first pressure threshold comprises: When the pressure stall rate of the target host is greater than a first rate threshold, and / or the pressure stall final value is greater than a first value, it is determined that the pressure of the target host is greater than or equal to the first pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment.
7. The method according to claim 1, characterized in that Determining a target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers includes: determining whether the pressure of the target host is less than a second pressure threshold according to the resource waiting information of the target host, and determining whether the pressure of each of the multiple containers is greater than a third pressure threshold according to the resource waiting information of each of the multiple containers; the second pressure threshold is less than the first pressure threshold; When the pressure of the target host is less than the second pressure threshold and the pressure of the first container is greater than the third pressure threshold, the target resource optimization strategy is determined to be a capacity expansion strategy; the capacity expansion strategy is used to perform a capacity expansion operation on the first container; the first container is any one of the multiple containers.
8. The method according to claim 7, characterized in that The determining, according to the resource waiting information of the target host, whether the pressure of the target host is less than a second pressure threshold comprises: When the pressure stall rate of the target host is less than or equal to a second rate threshold, and the pressure stall final value is less than or equal to a second value, it is determined that the pressure of the target host is less than the second pressure threshold; the pressure stall rate is the ratio of the second difference to the first difference; the second difference is the difference between the pressure stall final value and the pressure stall initial value; the first difference is the difference between the current moment and the initial moment; the second rate threshold is less than the first rate threshold; the second value is less than the first value.
9. A resource optimization device, characterized in that: The device comprises: a communication unit and a processing unit; The communication unit is used to obtain resource waiting information of a target host and resource waiting information of each of a plurality of containers included in the target host; the resource waiting information of the target host includes a pressure stall initial value of the target host and a pressure stall final value of the target host; the pressure stall initial value is the pressure stall information PSI corresponding to the target host at an initial moment; the pressure stall final value is the PSI corresponding to the target host at a current moment; The processing unit is used to determine a target resource optimization strategy according to the resource waiting information of the target host and / or the resource waiting information of each of the multiple containers.
10. A resource optimization device, characterized in that: include: A processor and a memory; wherein the memory is used to store one or more programs, and the one or more programs include computer-executable instructions. When the device is running, the processor executes the computer-executable instructions stored in the memory to enable the device to perform the method described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: When the computer-executable instructions stored in the computer-readable storage medium are executed by a processor of a resource optimization device, the resource optimization device is capable of performing the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises: a computer program or instructions, and when the computer program or instructions are run on a computer, the computer is caused to perform the method according to any one of claims 1 to 8.