Container group configuration method, device, equipment and medium
By obtaining the resource usage of the container group regularly and automatically updating the resource configuration, the problem that resource configuration cannot be dynamically adjusted in the existing technology is solved, and efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202311257156.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, the resource request amount and resource limit amount of the container group cannot be dynamically adjusted according to the actual operation, resulting in the problem of wasted resources or insufficient allocation.
By configuring the recommended component to obtain the resource usage of the target container group regularly, determine the recommended resource request and resource limit, and by configuring the update component to detect whether the current resource configuration meets the update conditions, automatically update the resource request and resource limit.
It realizes that during the application operation, the resource request and resource limit amount of the container group are automatically adjusted according to the actual resource usage, so as to avoid resource waste and insufficient resources.
Smart Images

Figure CN119718533A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a container group configuration method, device, equipment and medium. Background Art
[0002] Kubernetes, a container cluster management system, is an open source system for automatically deploying, scaling, and managing applications through container technology. Container groups are the basic operating units in Kubernetes, a container cluster management system. In order to effectively manage the various applications of an enterprise, each application can be deployed in the corresponding container group in Kubernetes, the container cluster management system, and the resource request and resource limit of the container group where each application is located can be configured, and then each application can be run in the container group. The resource request is the lower limit of the resources that the application in the container group needs to use during operation. The resource limit is the upper limit of the resources that the application in the container group needs to use during operation. Resources include CPU resources and memory resources.
[0003] In the related art, the container group configuration scheme is usually: after the application is deployed in the corresponding container group, a fixed resource request amount and resource limit amount are set for the container group where the application is located. During the operation of the application, the resource request amount and resource limit amount of the container group where the application is located remain unchanged. During the operation of the application, the container group configuration scheme of the related art cannot reasonably configure the resource request amount and resource limit amount of the container group where the application is located according to the actual operation situation, which may lead to resource waste or insufficient resources allocated to the application in the container group. Summary of the invention
[0004] The present invention provides a container group configuration method, apparatus, device and medium to solve the problem that the container group configuration scheme in the related art cannot reasonably configure the resource request amount and resource limit amount of the container group where the application is located according to the actual operation situation during the operation of the application, and there is a risk of causing resource waste or insufficient resources allocated to the application in the container group.
[0005] According to one aspect of the present invention, there is provided a container group configuration method, comprising:
[0006] By configuring the recommendation component, the resource usage of the target container group within a preset time period before the current moment is regularly obtained, and the recommended resource request amount and recommended resource limit amount of the target container group are determined according to the resource usage;
[0007] By configuring the update component, according to the recommended resource request amount and the recommended resource limit amount, detecting whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount;
[0008] Through the configuration update component, after detecting that the resource request amount or resource limit amount of the target container group meets the corresponding update condition, the current resource request amount or current resource limit amount of the target container group is updated according to the recommended resource request amount or the recommended resource limit amount.
[0009] The technical solution of the embodiment of the present invention can determine the resource request amount and resource limit amount suitable for the container group according to the resource usage of the container group where the application is located within a period of time during the operation of the application, and can automatically update the resource request amount and resource limit amount of the target container group at the current moment to the resource request amount and resource limit amount suitable for the target container group after detecting that the resource request amount and resource limit amount of the container group need to be updated, so that the resource request amount and resource limit amount of the target container group are automatically configured according to the actual resource usage of the target container group during the operation of the application, and the resource request amount and resource limit amount of the target container group at the current moment are continuously updated to the resource request amount and resource limit amount suitable for the target container group, thereby avoiding the beneficial effect of resource waste or insufficient resources allocated to the application in the container group.
[0010] Optionally, the resource usage includes a CPU usage and a memory usage, the recommended resource request includes a recommended CPU request and a recommended memory request, the recommended resource limit includes a recommended CPU limit and a recommended memory limit, the current resource request includes a current CPU request and a current memory request, and the current resource limit includes a current CPU limit and a current memory limit;
[0011] By configuring the recommendation component, the resource usage of the target container group within a preset time period before the current moment is periodically obtained, and according to the resource usage, the recommended resource request amount and the recommended resource limit amount of the target container group are determined, including:
[0012] Configure the recommended components to do the following:
[0013] Regularly obtain the CPU usage and memory usage of the target container group within a preset time period before the current time;
[0014] Determine a recommended CPU request and a recommended CPU limit for the target container group according to a minimum value and a maximum value of CPU usage of the target container group within a preset time period before a current moment;
[0015] A recommended memory request amount and a recommended memory limit amount of the target container group are determined according to a minimum value and a maximum value of memory usage of the target container group within a preset time period before a current moment.
[0016] The technical solution of the embodiment of the present invention can determine the CPU request amount, CPU limit amount, memory request amount and memory limit amount suitable for the target container group according to the CPU usage and memory usage of the target container group within a preset time period before the current moment, so that the resource request amount and resource limit amount suitable for the target container group can be determined according to the resource usage of the target container group within a period of time.
[0017] Optionally, by configuring an update component, detecting, according to the recommended resource request amount and the recommended resource limit amount, whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount, includes:
[0018] By configuring the update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount, it is detected whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions.
[0019] The technical solution of the embodiment of the present invention can automatically detect whether the current CPU request amount, current memory request amount, current CPU limit amount and current memory limit amount of the target container group need to be updated according to the recommended CPU request amount, recommended memory request amount, recommended CPU limit amount and recommended memory limit amount.
[0020] Optionally, by configuring the update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount, and the recommended memory limit amount, detecting whether the current CPU request amount, the current memory request amount, the current CPU limit amount, and the current memory limit amount of the target container group meet corresponding update conditions includes:
[0021] Perform the following operations by configuring the update component:
[0022] Detecting whether a difference between a current CPU request amount of the target container group and the recommended CPU request amount is greater than a first preset difference, and if it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than the first preset difference, determining that the current CPU request amount of the target container group meets a corresponding update condition;
[0023] Detecting whether a difference between a current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference; if it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than the second preset difference, determining that the current memory request amount of the target container group meets a corresponding update condition;
[0024] Detecting whether a difference between a current CPU limit of the target container group and the recommended CPU limit is greater than a third preset difference, and if it is detected that the difference between the current CPU limit of the target container group and the recommended CPU limit is greater than the third preset difference, determining that the current CPU limit of the target container group meets a corresponding update condition;
[0025] Detect whether a difference between a current memory limit of the target container group and the recommended memory limit is greater than a fourth preset difference; if it is detected that the difference between the current memory limit of the target container group and the recommended memory limit is greater than the fourth preset difference, determine that the current memory limit of the target container group meets the corresponding update condition.
[0026] The technical solution of the embodiment of the present invention can automatically detect whether the current CPU request amount of the target container group needs to be updated according to the difference between the current CPU request amount of the target container group and the recommended CPU request amount, can automatically detect whether the current memory request amount of the target container group needs to be updated according to the difference between the current memory request amount of the target container group and the recommended memory request amount, can automatically detect whether the current CPU limit amount of the target container group needs to be updated according to the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount, and can automatically detect whether the current memory limit amount of the target container group needs to be updated according to the difference between the current memory limit amount of the target container group and the recommended memory limit amount.
[0027] Optionally, after detecting that the resource request amount or resource limit amount of the target container group meets a corresponding update condition, updating the current resource request amount or current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount by the configuration update component includes:
[0028] The configuration update component performs the following operations:
[0029] After detecting that the current CPU request amount of the target container group meets the corresponding update condition, updating the current CPU request amount of the target container group to the recommended CPU request amount;
[0030] After detecting that the current memory request amount of the target container group meets the corresponding update condition, updating the current memory request amount of the target container group to the recommended memory request amount;
[0031] After detecting that the current CPU limit of the target container group meets the corresponding update condition, updating the current CPU limit of the target container group to the recommended CPU limit;
[0032] After detecting that the current memory limit of the target container group meets the corresponding update condition, the current memory limit of the target container group is updated to the recommended memory limit.
[0033] The technical solution of the embodiment of the present invention can update the current CPU request amount, current memory request amount, current CPU limit amount or current memory limit amount of the target container group to the CPU request amount, memory request amount, CPU limit amount or memory limit amount suitable for the target container group after detecting that the current CPU request amount, current memory request amount, current CPU limit amount or current memory limit amount of the target container group needs to be updated.
[0034] Optionally, the CPU usage and memory usage of the target container group within a preset time period before the current time are obtained periodically, including:
[0035] According to the preset time interval, the CPU usage and memory usage of the target container group within the preset time period before the current moment are obtained from the monitoring server on a regular basis.
[0036] The technical solution of the embodiment of the present invention can periodically obtain the CPU usage and memory usage of the target container group within a preset time period before the current moment from the monitoring server, so as to continuously determine the CPU request amount, CPU limit amount, memory request amount and memory limit amount suitable for the target container group according to the obtained CPU usage and memory usage of the target container group within the preset time period before the current moment.
[0037] Optionally, also include:
[0038] After detecting the restart of the target container group, the container restart component updates the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group.
[0039] The technical solution of the embodiment of the present invention can automatically update the current resource request amount and the current resource limit amount of the target container group to the resource request amount and the resource limit amount suitable for the target container group after the target container group is restarted.
[0040] According to another aspect of the present invention, there is provided a container group configuration device, comprising:
[0041] A configuration recommendation module is used to periodically obtain the resource usage of the target container group within a preset time period before the current moment by configuring a recommendation component, and determine the recommended resource request amount and recommended resource limit amount of the target container group according to the resource usage;
[0042] A configuration detection module, configured to detect, by configuring an update component, whether a current resource request amount and a current resource limit amount of the target container group meet an update condition corresponding to the current resource request amount and the current resource limit amount according to the recommended resource request amount and the recommended resource limit amount;
[0043] A configuration update module is used to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount through the configuration update component after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update condition.
[0044] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0045] at least one processor;
[0046] and a memory connected in network communication with the at least one processor;
[0047] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the container group configuration method described in any embodiment of the present invention.
[0048] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the container group configuration method described in any embodiment of the present invention when executed.
[0049] The technical solution of the embodiment of the present invention configures a recommendation component to periodically obtain the resource usage of the target container group within a preset time period before the current moment, and determines the recommended resource request amount and the recommended resource limit amount of the target container group according to the resource usage; configures an update component to detect whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount according to the recommended resource request amount and the recommended resource limit amount; configures the update component to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update conditions, thereby solving the problem that the container group configuration solution of the related technology cannot reasonably configure the resource request amount and the resource limit amount of the container group where the application is located according to the actual operation situation during the operation of the application. The amount of resources allocated to the application in the container group may lead to a risk of wasting resources or insufficient resources being allocated to the application in the container group. During the operation of the application, the resource request amount and resource limit amount suitable for the container group can be determined according to the resource usage of the container group where the application is located over a period of time at regular intervals. After detecting that the resource request amount and resource limit amount of the container group need to be updated, the resource request amount and resource limit amount of the target container group at the current moment can be automatically updated to the resource request amount and resource limit amount suitable for the target container group. This realizes that during the operation of the application, the resource request amount and resource limit amount of the target container group are automatically configured according to the actual resource usage of the target container group, and the resource request amount and resource limit amount of the target container group at the current moment are continuously updated to the resource request amount and resource limit amount suitable for the target container group, thereby avoiding the beneficial effect of wasting resources or insufficient resources being allocated to the application in the container group.
[0050] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1 The present invention provides a flowchart of a method for configuring a container group.
[0053] Figure 2This is a flow chart of a container group configuration method provided in Embodiment 2 of the present invention.
[0054] Figure 3 This is a flow chart of a container group configuration method provided in Embodiment 3 of the present invention.
[0055] Figure 4 A schematic diagram of the structure of a container group configuration device provided in Embodiment 4 of the present invention.
[0056] Figure 5 A schematic diagram of the structure of an electronic device for implementing the container group configuration method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0058] It should be noted that the terms "target", "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprise", "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes 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.
[0059] Embodiment 1
[0060] Figure 1 A flowchart of a container group configuration method provided in the first embodiment of the present invention. This embodiment can be applied to the case where the resource request amount and resource limit amount of the container group where the application is located are configured according to the actual operation situation during the operation of the application. The method can be executed by a container group configuration device, which can be implemented in the form of hardware and / or software, and the container group configuration device can be configured in an electronic device. The electronic device is used to configure and manage the resource request amount and resource limit amount of each container group in the container cluster management system Kubernetes. Figure 1 As shown, the method includes:
[0061] Step 101: By configuring a recommendation component, the resource usage of a target container group within a preset time period before the current moment is periodically acquired, and a recommended resource request amount and a recommended resource limit amount of the target container group are determined according to the resource usage.
[0062] Optionally, the target container group is one or more container groups in the container cluster management system Kubernetes that run applications. The applications in the target container group need to use resources in the container cluster management system Kubernetes during operation. The resources in the container cluster management system Kubernetes include central processing unit resources and memory resources. The central processing unit resources are the processing cores of all central processing units in the container cluster management system Kubernetes. The memory resources are all memory spaces in the container cluster management system Kubernetes. Exemplarily, the container cluster management system Kubernetes includes 64 central processing unit processing cores. The 64 central processing unit processing cores constitute the central processing unit resources in the container cluster management system Kubernetes. The container cluster management system Kubernetes includes a memory space with a capacity of 256GB. The 256GB memory space constitutes the memory resources in the container cluster management system Kubernetes.
[0063] Optionally, resource usage includes CPU usage and memory usage. CPU usage is the number of CPU processing cores used by applications in the container group. Memory usage is the capacity of memory space used by applications in the container group.
[0064] Optionally, the resource request amount includes a CPU request amount and a memory request amount. The CPU request amount is the lower limit of the number of CPU processing cores used by the applications in the container group. The memory request amount is the lower limit of the capacity of the memory space used by the applications in the container group. Exemplarily, the CPU request amount of the container group is 1, indicating that the number of CPU processing cores used by the applications in the container group can be greater than or equal to 1. The memory request amount of the container group is 2, indicating that the capacity of the memory space used by the applications in the container group can be greater than or equal to 2GB.
[0065] Optionally, the resource limit includes a CPU limit and a memory limit. The CPU limit is the upper limit of the number of CPU processing cores used by the applications in the container group. The memory limit is the upper limit of the capacity of the memory space used by the applications in the container group. Exemplarily, the CPU limit request of the container group is 3, indicating that the number of CPU processing cores used by the applications in the container group needs to be less than or equal to 3. The memory limit of the container group is 4, indicating that the capacity of the memory space used by the applications in the container group needs to be less than or equal to 4GB.
[0066] Optionally, the container cluster management system Kubernetes will allocate CPU resources to applications in the container group based on the container group's CPU request and CPU limit, ensuring that the number of CPU processing cores used by applications in the container group is greater than or equal to the container group's CPU request and less than or equal to the container group's CPU limit. The container cluster management system Kubernetes will allocate memory resources to applications in the container group based on the container group's memory request and memory limit, ensuring that the capacity of the memory space used by applications in the container group is greater than or equal to the container group's memory request and less than or equal to the container group's memory limit.
[0067] Optionally, if the CPU request of a container group is too large, the CPU resources allocated to the applications in the container group will be wasted. If the CPU request of a container group is too small, the CPU resources allocated to the applications in the container group will be insufficient, and the applications will not run normally. If the CPU limit of a container group is too large, the CPU resources allocated to the applications in the container group will be wasted. If the CPU limit of a container group is too small, the CPU resources allocated to the applications in the container group will be insufficient, and the applications will not run normally.
[0068] Optionally, if the memory request of a container group is too large, the memory resources allocated to the applications in the container group will be wasted. If the memory request of a container group is too small, the memory resources allocated to the applications in the container group will be insufficient, and the applications will not run properly. If the memory limit of a container group is too large, the memory resources allocated to the applications in the container group will be wasted. If the memory limit of a container group is too small, the memory resources allocated to the applications in the container group will be insufficient, and the applications will not run properly.
[0069] Optionally, the resource request amount and resource limit amount of the target container group are stored in the electronic device. The current resource request amount and current resource limit amount of the target container group are the resource request amount and resource limit amount of the target container group at the current moment. The resource request amount and resource limit amount of the target container group at the current moment may be the resource request amount and resource limit amount set by the technician for the target container group after the application is deployed in the target container group, or may be the resource request amount and resource limit amount of the target container group updated in the last configuration update process.
[0070] Optionally, the configuration recommendation component is a component set in the electronic device for periodically obtaining the resource usage of the target container group within a preset time period before the current moment, and determining the recommended resource request amount and the recommended resource limit amount of the target container group according to the obtained resource usage of the target container group within the preset time period before the current moment.
[0071] Optionally, the recommended resource request amount of the target container group is a resource request amount suitable for the target container group determined according to the resource usage of the target container group within a preset time period before the current moment.
[0072] Optionally, the recommended resource request amount includes a recommended CPU request amount and a recommended memory request amount. The recommended CPU request amount is a CPU request amount suitable for the target container group determined based on the CPU usage of the target container group within a preset time period before the current moment. The recommended memory request amount is a memory request amount suitable for the target container group determined based on the memory usage of the target container group within a preset time period before the current moment.
[0073] Optionally, the recommended resource limit includes a recommended CPU limit and a recommended memory limit. The recommended CPU limit is a CPU limit suitable for the target container group determined based on the CPU usage of the target container group within a preset time period before the current moment. The recommended memory limit is a memory limit suitable for the target container group determined based on the memory usage of the target container group within a preset time period before the current moment.
[0074] Optionally, the resource usage includes a CPU usage and a memory usage, the recommended resource request includes a recommended CPU request and a recommended memory request, the recommended resource limit includes a recommended CPU limit and a recommended memory limit, the current resource request includes a current CPU request and a current memory request, and the current resource limit includes a current CPU limit and a current memory limit; by configuring a recommendation component, regularly obtaining the resource usage of the target container group within a preset time before the current moment, and determining the recommended resource request and recommended resource limit of the target container group according to the resource usage, including: performing the following operations by configuring the recommendation component: regularly obtaining the CPU usage and memory usage of the target container group within the preset time before the current moment; determining the recommended CPU request and recommended CPU limit of the target container group according to the minimum and maximum values of the CPU usage of the target container group within the preset time before the current moment; and determining the recommended memory request and recommended memory limit of the target container group according to the minimum and maximum values of the memory usage of the target container group within the preset time before the current moment.
[0075] Thus, the CPU request amount, CPU limit amount, memory request amount and memory limit amount suitable for the target container group can be determined regularly according to the CPU usage and memory usage of the target container group within a preset time period before the current moment, so that the resource request amount and resource limit amount suitable for the target container group can be determined according to the resource usage of the target container group over a period of time.
[0076] Optionally, a monitoring server is provided in the container cluster management system Kubernetes. The monitoring server is a server used to regularly collect resource usage of the target container group according to the target time interval. The target time interval is a pre-set time interval. The target time interval can be set according to business needs. Exemplarily, the target time interval is 1 second. Resource usage includes CPU usage and memory usage. The monitoring server collects the CPU usage and memory usage of the target container group once every target time interval. The configuration recommendation component establishes a communication connection with the monitoring server, and the CPU usage and memory usage of the target container group collected by the monitoring server can be obtained based on the established communication connection.
[0077] Optionally, periodically obtaining the CPU usage and memory usage of the target container group within a preset time period before the current moment includes: periodically obtaining the CPU usage and memory usage of the target container group within the preset time period before the current moment from the monitoring server at a preset time interval.
[0078] Thus, the CPU usage and memory usage of the target container group within the preset time period before the current moment can be obtained from the monitoring server at regular intervals, so that the CPU request amount, CPU limit amount, memory request amount and memory limit amount suitable for the target container group can be continuously determined based on the obtained CPU usage and memory usage of the target container group within the preset time period before the current moment.
[0079] Optionally, the preset time interval is a preset time interval. The preset time interval can be set according to business needs. Exemplarily, the preset time interval is 1 minute. The configuration recommendation component performs an operation of obtaining the CPU usage and memory usage of the target container group within the preset time length before the current moment from the monitoring server once every preset time interval. The CPU usage and memory usage of the target container group within the preset time length before the current moment are the CPU usage and memory usage of the target container group collected by the monitoring server within the preset time length before the current moment. The preset time length is a preset time length. The preset time length can be set according to business needs. Exemplarily, the preset time length is 1 minute.
[0080] Optionally, after each acquisition of the CPU usage and memory usage of the target container group within a preset time period before the current moment, the configuration recommendation component determines the recommended CPU request amount and the recommended CPU limit amount of the target container group according to the minimum value and the maximum value of the CPU usage of the target container group within the preset time period before the current moment, and then determines the recommended memory request amount and the recommended memory limit amount of the target container group according to the minimum value and the maximum value of the memory usage of the target container group within the preset time period before the current moment.
[0081] Optionally, determining the recommended CPU request amount and the recommended CPU limit amount of the target container group according to the minimum value and the maximum value of the CPU usage of the target container group within a preset time before the current moment includes: after obtaining the CPU usage of the target container group within the preset time before the current moment, determining the minimum value and the maximum value of the CPU usage of the target container group within the preset time before the current moment; determining the minimum value of the CPU usage of the target container group within the preset time before the current moment as the recommended CPU request amount of the target container group; and determining the maximum value of the CPU usage of the target container group within the preset time before the current moment as the recommended CPU limit amount of the target container group.
[0082] Optionally, the minimum value of the CPU usage of the target container group within the preset time length before the current moment is the lower limit of the number of processing cores of the CPU used by the application in the target container group within the preset time length before the current moment. Normally, the minimum value of the CPU usage of the target container group within the preset time length before the current moment is set as the CPU request amount of the target container group, and the CPU request amount is neither too large nor too small, and is a CPU request amount suitable for the target container group. Therefore, the minimum value of the CPU usage of the target container group within the preset time length before the current moment is the CPU request amount suitable for the target container group determined based on the CPU usage of the target container group within the preset time length before the current moment, and the minimum value of the CPU usage of the target container group within the preset time length before the current moment is determined as the recommended CPU request amount of the target container group.
[0083] Optionally, the maximum value of the CPU usage of the target container group within the preset time length before the current moment is the upper limit of the number of processing cores of the CPU used by the applications in the target container group within the preset time length before the current moment. Normally, the maximum value of the CPU usage of the target container group within the preset time length before the current moment is set as the CPU limit of the target container group, and the CPU limit is neither too large nor too small, and is a CPU limit suitable for the target container group. Therefore, the maximum value of the CPU usage of the target container group within the preset time length before the current moment is the CPU limit suitable for the target container group determined based on the CPU usage of the target container group within the preset time length before the current moment, and the maximum value of the CPU usage of the target container group within the preset time length before the current moment is determined as the recommended CPU limit of the target container group.
[0084] Optionally, determining the minimum and maximum CPU usage of the target container group within a preset time period before the current moment includes: sorting the CPU usage of the target container group within the preset time period before the current moment in ascending order of the CPU usage values; determining the first CPU usage as the minimum CPU usage of the target container group within the preset time period before the current moment; and determining the last CPU usage as the maximum CPU usage of the target container group within the preset time period before the current moment.
[0085] Optionally, determining a recommended memory request amount and a recommended memory limit amount of the target container group according to a minimum value and a maximum value of memory usage of the target container group within a preset time length before a current moment includes: after acquiring the memory usage of the target container group within the preset time length before a current moment, determining a minimum value and a maximum value of memory usage of the target container group within the preset time length before a current moment; determining the minimum value of memory usage of the target container group within the preset time length before a current moment as the recommended memory request amount of the target container group; and determining the maximum value of memory usage of the target container group within the preset time length before a current moment as the recommended memory limit amount of the target container group.
[0086] Optionally, the minimum value of the memory usage of the target container group within the preset time length before the current moment is the lower limit of the number of processing cores of the memory used by the application in the target container group within the preset time length before the current moment. Normally, the minimum value of the memory usage of the target container group within the preset time length before the current moment is set as the memory request amount of the target container group, and the memory request amount is neither too large nor too small, and is a memory request amount suitable for the target container group. Therefore, the minimum value of the memory usage of the target container group within the preset time length before the current moment is the memory request amount suitable for the target container group determined based on the memory usage of the target container group within the preset time length before the current moment, and the minimum value of the memory usage of the target container group within the preset time length before the current moment is determined as the recommended memory request amount of the target container group.
[0087] Optionally, the maximum value of the memory usage of the target container group within the preset time length before the current moment is the upper limit of the number of processing cores of the memory used by the application in the target container group within the preset time length before the current moment. Normally, the maximum value of the memory usage of the target container group within the preset time length before the current moment is set as the memory limit of the target container group, and the memory limit is neither too large nor too small, and is a memory limit suitable for the target container group. Therefore, the maximum value of the memory usage of the target container group within the preset time length before the current moment is the memory limit suitable for the target container group determined based on the memory usage of the target container group within the preset time length before the current moment, and the maximum value of the memory usage of the target container group within the preset time length before the current moment is determined as the recommended memory limit of the target container group.
[0088] Optionally, determining the minimum value and the maximum value of the memory usage of the target container group within a preset time length before the current moment includes: sorting the memory usage of the target container group within the preset time length before the current moment in ascending order of the values of the memory usage; determining the memory usage ranked first as the minimum value of the memory usage of the target container group within the preset time length before the current moment; and determining the memory usage ranked last as the maximum value of the memory usage of the target container group within the preset time length before the current moment.
[0089] Step 102: By configuring the update component, based on the recommended resource request amount and the recommended resource limit amount, detect whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount.
[0090] Optionally, the configuration update component is a component set in the electronic device for detecting whether the current resource request amount and the current resource limit amount of the target container group meet the corresponding update conditions based on the recommended resource request amount and the recommended resource limit amount after monitoring that the configuration recommendation component determines the recommended resource request amount and the recommended resource limit amount of the target container group based on the resource usage, and updating the recommended resource request amount or the recommended resource limit amount of the target container group based on the detection result.
[0091] Optionally, the configuration update component can monitor whether the configuration recommendation component determines the recommended resource request amount and recommended resource limit amount of the target container group based on the resource usage. After each monitoring that the configuration recommendation component determines the recommended resource request amount and recommended resource limit amount of the new target container group based on the resource usage, the configuration update component detects whether the current resource request amount and current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and current resource limit amount based on the newly determined recommended resource request amount and recommended resource limit amount. If it is detected that the current resource request amount or current resource limit amount of the target container group meets the corresponding update conditions, the current resource request amount or current resource limit amount is updated. If it is detected that neither the current resource request amount nor the current resource limit amount of the target container group meets the corresponding update conditions, it is determined that neither the current resource request amount nor the current resource limit amount needs to be updated, and the configuration recommendation component continues to monitor whether it determines the recommended resource request amount and recommended resource limit amount of the target container group based on the resource usage.
[0092] Optionally, the update condition corresponding to the current resource request amount is a condition for detecting whether the current resource request amount of the target container group needs to be updated. The update condition corresponding to the current resource request amount includes an update condition corresponding to the current CPU request amount and an update condition corresponding to the current memory request amount. The update condition corresponding to the current resource limit amount is a condition for detecting whether the current resource limit amount of the target container group needs to be updated. The update condition corresponding to the current resource limit amount includes an update condition corresponding to the current CPU limit amount and an update condition corresponding to the current memory limit amount.
[0093] Optionally, by configuring an update component, according to the recommended resource request amount and the recommended resource limit amount, detecting whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount, including: by configuring an update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount, detecting whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions.
[0094] Therefore, it is possible to automatically detect whether the current CPU request amount, current memory request amount, current CPU limit amount and current memory limit amount of the target container group need to be updated based on the recommended CPU request amount, recommended memory request amount, recommended CPU limit amount and recommended memory limit amount.
[0095] Optionally, the update condition corresponding to the current CPU request amount may be that the difference between the current CPU request amount and the recommended CPU request amount is greater than a first preset difference. The first preset difference is a preset difference. Normally, if the difference between the current CPU request amount and the recommended CPU request amount is greater than the first preset difference, it indicates that the current CPU request amount is significantly deviated from the CPU request amount suitable for the target container group, and there is a risk of causing the CPU resources allocated to the application in the container group to be wasted or the CPU resources allocated to the application in the container group to be insufficient, and the current CPU request amount needs to be updated. If the difference between the current CPU request amount and the recommended CPU request amount is less than or equal to the first preset difference, it indicates that the current CPU request amount is close to the CPU request amount suitable for the target container group, and there is no risk of causing the CPU resources allocated to the application in the container group to be wasted or the CPU resources allocated to the application in the container group to be insufficient, and the current CPU request amount does not need to be updated.
[0096] Optionally, the update condition corresponding to the current memory request amount may be that the difference between the current memory request amount and the recommended memory request amount is greater than a second preset difference. The second preset difference is a preset difference. Normally, if the difference between the current memory request amount and the recommended memory request amount is greater than the second preset difference, it indicates that the current memory request amount is significantly deviated from the memory request amount suitable for the target container group, and there is a risk of wasting the memory resources allocated to the applications in the container group or insufficient memory resources allocated to the applications in the container group, and the current memory request amount needs to be updated. If the difference between the current memory request amount and the recommended memory request amount is less than or equal to the second preset difference, it indicates that the current memory request amount is close to the memory request amount suitable for the target container group, and there is no risk of wasting the memory resources allocated to the applications in the container group or insufficient memory resources allocated to the applications in the container group, and the current memory request amount does not need to be updated.
[0097] Optionally, the update condition corresponding to the current CPU limit may be that the difference between the current CPU limit and the recommended CPU limit is greater than a third preset difference. The third preset difference is a preset difference. Normally, if the difference between the current CPU limit and the recommended CPU limit is greater than the third preset difference, it indicates that the current CPU limit is significantly deviated from the CPU limit suitable for the target container group, and there is a risk of wasting the CPU resources allocated to the applications in the container group or insufficient CPU resources allocated to the applications in the container group, and the current CPU limit needs to be updated. If the difference between the current CPU limit and the recommended CPU limit is less than or equal to the third preset difference, it indicates that the current CPU limit is close to the CPU limit suitable for the target container group, and there is no risk of wasting the CPU resources allocated to the applications in the container group or insufficient CPU resources allocated to the applications in the container group, and there is no need to update the current CPU limit.
[0098] Optionally, the update condition corresponding to the current memory limit may be that the difference between the current memory limit and the recommended memory limit is greater than a fourth preset difference. The fourth preset difference is a preset difference. Normally, if the difference between the current memory limit and the recommended memory limit is greater than the fourth preset difference, it indicates that the current memory limit is significantly deviated from the memory limit suitable for the target container group, and there is a risk of wasting the memory resources allocated to the applications in the container group or insufficient memory resources allocated to the applications in the container group, and the current memory limit needs to be updated. If the difference between the current memory limit and the recommended memory limit is less than or equal to the fourth preset difference, it indicates that the current memory limit is close to the memory limit suitable for the target container group, and there is no risk of wasting the memory resources allocated to the applications in the container group or insufficient memory resources allocated to the applications in the container group, and the current memory limit does not need to be updated.
[0099] Optionally, by configuring an update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount, detecting whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions, including: performing the following operations by configuring the update component: detecting whether the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than a first preset difference; if it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than the first preset difference, determining that the current CPU request amount of the target container group meets the corresponding update conditions; detecting whether the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference; if If it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference, it is determined that the current memory request amount of the target container group meets the corresponding update condition; if it is detected that the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount is greater than a third preset difference, if it is detected that the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount is greater than the third preset difference, it is determined that the current CPU limit amount of the target container group meets the corresponding update condition; if it is detected that the difference between the current memory limit amount of the target container group and the recommended memory limit amount is greater than a fourth preset difference, if it is detected that the difference between the current memory limit amount of the target container group and the recommended memory limit amount is greater than the fourth preset difference, it is determined that the current memory limit amount of the target container group meets the corresponding update condition.
[0100] Therefore, it is possible to automatically detect whether the current CPU request amount of the target container group needs to be updated based on the difference between the current CPU request amount of the target container group and the recommended CPU request amount. It is possible to automatically detect whether the current memory request amount of the target container group needs to be updated based on the difference between the current memory request amount of the target container group and the recommended memory request amount. It is possible to automatically detect whether the current CPU limit amount of the target container group needs to be updated based on the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount. It is possible to automatically detect whether the current memory limit amount of the target container group needs to be updated based on the difference between the current memory limit amount of the target container group and the recommended memory limit amount.
[0101] Optionally, it is detected whether the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than a first preset difference. If it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than the first preset difference, it is determined that the current CPU request amount of the target container group meets the update condition corresponding to the current CPU request amount, and the current CPU request amount needs to be updated. If it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is less than or equal to the first preset difference, it is determined that the current CPU request amount of the target container group does not meet the update condition corresponding to the current CPU request amount, and the current CPU request amount does not need to be updated.
[0102] Optionally, it is detected whether the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference. If it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than the second preset difference, it is determined that the current memory request amount of the target container group meets the update condition corresponding to the current memory request amount, and the current memory request amount needs to be updated. If it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is less than or equal to the second preset difference, it is determined that the current memory request amount of the target container group does not meet the update condition corresponding to the current memory request amount, and the current memory request amount does not need to be updated.
[0103] Optionally, it is detected whether the difference between the current CPU limit of the target container group and the recommended CPU limit is greater than a third preset difference. If it is detected that the difference between the current CPU limit of the target container group and the recommended CPU limit is greater than the third preset difference, it is determined that the current CPU limit of the target container group meets the update condition corresponding to the current CPU limit, and the current CPU limit needs to be updated. If it is detected that the difference between the current CPU limit of the target container group and the recommended CPU limit is less than or equal to the third preset difference, it is determined that the current CPU limit of the target container group does not meet the update condition corresponding to the current CPU limit, and the current CPU limit does not need to be updated.
[0104] Optionally, it is detected whether the difference between the current memory limit of the target container group and the recommended memory limit is greater than a fourth preset difference. If it is detected that the difference between the current memory limit of the target container group and the recommended memory limit is greater than the fourth preset difference, it is determined that the current memory limit of the target container group meets the update condition corresponding to the current memory limit, and the current memory limit needs to be updated. If it is detected that the difference between the current memory limit of the target container group and the recommended memory limit is less than or equal to the fourth preset difference, it is determined that the current memory limit of the target container group does not meet the update condition corresponding to the current memory limit, and the current memory limit does not need to be updated.
[0105] Step 103: After detecting that the resource request amount or resource limit amount of the target container group meets the corresponding update condition, the configuration update component updates the current resource request amount or current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount.
[0106] Optionally, after detecting that the resource request amount or resource limit amount of the target container group satisfies the corresponding update condition, the configuration update component updates the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount, including: performing the following operations through the configuration update component: after detecting that the current CPU request amount of the target container group satisfies the corresponding update condition, updating the current CPU request amount of the target container group to the recommended CPU request amount; after detecting that the current memory request amount of the target container group satisfies the corresponding update condition, updating the current memory request amount of the target container group to the recommended memory request amount; after detecting that the current CPU limit amount of the target container group satisfies the corresponding update condition, updating the current CPU limit amount of the target container group to the recommended CPU limit amount; after detecting that the current memory limit amount of the target container group satisfies the corresponding update condition, updating the current memory limit amount of the target container group to the recommended memory limit amount.
[0107] Thus, after detecting that the current CPU request amount, current memory request amount, current CPU limit amount, or current memory limit amount of the target container group needs to be updated, the current CPU request amount, current memory request amount, current CPU limit amount, or current memory limit amount of the target container group can be updated to the CPU request amount, memory request amount, CPU limit amount, or memory limit amount suitable for the target container group.
[0108] Optionally, if it is detected that the current CPU request, current memory request, current CPU limit and current memory limit of the target container group do not meet the corresponding update conditions, it is determined that the current CPU request, current memory request, current CPU limit and current memory limit do not need to be updated, and the configuration recommendation component continues to monitor whether it determines the recommended resource request and recommended resource limit of the target container group based on the resource usage.
[0109] Optionally, the method further includes: after detecting that the target container group is restarted, updating the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group through the container restart component.
[0110] Therefore, after the target container group is restarted, the current resource request amount and the current resource limit amount of the target container group can be automatically updated to the resource request amount and the resource limit amount suitable for the target container group.
[0111] Optionally, the target container group may be restarted according to an externally input restart instruction, and may also be restarted after a failure occurs. The restart instruction is an instruction for instructing the target container group to restart. The container restart component is a component set in the electronic device for updating the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group after detecting the restart of the target container group. The container restart component can detect whether the target container group is restarted. After detecting the restart of the target container group, the container restart component will update the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group.
[0112] Optionally, after the target container group is restarted, the current resource request and current resource limit of the target container group will be restored to the resource request and resource limit set by the technician for the target container group. The latest recommended resource request and recommended resource limit corresponding to the target container group are the latest recommended resource request and recommended resource limit of the target container group determined by the configuration recommendation component.
[0113] Optionally, updating the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group includes: updating the current resource request amount of the target container group to the latest recommended resource request amount corresponding to the target container group; and updating the current resource limit amount of the target container group to the latest recommended resource limit amount corresponding to the target container group.
[0114] The technical solution of the embodiment of the present invention configures a recommendation component to periodically obtain the resource usage of the target container group within a preset time period before the current moment, and determines the recommended resource request amount and the recommended resource limit amount of the target container group according to the resource usage; configures an update component to detect whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount according to the recommended resource request amount and the recommended resource limit amount; configures the update component to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update conditions, thereby solving the problem that the container group configuration solution of the related technology cannot reasonably configure the resource request amount and the resource limit amount of the container group where the application is located according to the actual operation situation during the operation of the application. The amount of resources allocated to the application in the container group may lead to a risk of wasting resources or insufficient resources being allocated to the application in the container group. During the operation of the application, the resource request amount and resource limit amount suitable for the container group can be determined according to the resource usage of the container group where the application is located over a period of time at regular intervals. After detecting that the resource request amount and resource limit amount of the container group need to be updated, the resource request amount and resource limit amount of the target container group at the current moment can be automatically updated to the resource request amount and resource limit amount suitable for the target container group. This realizes that during the operation of the application, the resource request amount and resource limit amount of the target container group are automatically configured according to the actual resource usage of the target container group, and the resource request amount and resource limit amount of the target container group at the current moment are continuously updated to the resource request amount and resource limit amount suitable for the target container group, thereby avoiding the beneficial effect of wasting resources or insufficient resources being allocated to the application in the container group.
[0115] Embodiment 2
[0116] Figure 2 This is a flow chart of a container group configuration method provided in Embodiment 2 of the present invention. This embodiment of the present invention can be combined with each optional solution in one or more of the above embodiments. Figure 2 As shown, the method includes:
[0117] Step 201: By configuring the recommendation component, the CPU usage and memory usage of the target container group within a preset time period before the current moment are obtained periodically.
[0118] Step 202: By configuring the recommendation component, according to the minimum and maximum CPU usage of the target container group within a preset time period before the current moment, determine the recommended CPU request amount and the recommended CPU limit amount of the target container group.
[0119] Step 203: By configuring the recommendation component, a recommended memory request amount and a recommended memory limit amount of the target container group are determined according to the minimum value and the maximum value of the memory usage of the target container group within a preset time period before the current moment.
[0120] Step 204: By configuring the update component, based on the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount, and the recommended memory limit amount, detect whether the current CPU request amount, the current memory request amount, the current CPU limit amount, and the current memory limit amount of the target container group meet the corresponding update conditions.
[0121] Step 205: After detecting that the current CPU request, current memory request, current CPU limit or current memory limit of the target container group meets the corresponding update condition by configuring the update component, the current CPU request, current memory request, current CPU limit or current memory limit of the target container group is updated according to the recommended CPU request, recommended memory request, recommended CPU limit or recommended memory limit.
[0122] The technical solution of the embodiment of the present invention can determine the CPU request amount, memory request amount, CPU limit amount and memory limit amount suitable for the container group according to the CPU usage and memory usage of the container group where the application is located within a period of time during the running process of the application. After detecting that the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the container group need to be updated, the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group at the current moment are automatically updated to the CPU request amount, memory request amount, CPU limit amount and memory limit amount suitable for the target container group, so that the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group are automatically configured according to the actual resource usage of the target container group during the running process of the application, and the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group at the current moment are continuously updated to the CPU request amount, memory request amount, CPU limit amount and memory limit amount suitable for the target container group, thereby avoiding the beneficial effect of resource waste or insufficient resources allocated to the application in the container group.
[0123] Embodiment 3
[0124] Figure 3 A flowchart of a container group configuration method provided in Embodiment 3 of the present invention includes the following steps:
[0125] Step 301: By configuring the recommendation component, the CPU usage and memory usage of the target container group within a preset time period before the current moment are obtained from the monitoring server at a preset time interval.
[0126] Step 302: By configuring the recommendation component, according to the minimum and maximum CPU usage of the target container group within a preset time period before the current moment, determine the recommended CPU request and recommended CPU limit of the target container group.
[0127] Step 303: By configuring the recommendation component, a recommended memory request amount and a recommended memory limit amount of the target container group are determined according to the minimum value and the maximum value of the memory usage of the target container group within a preset time period before the current moment.
[0128] Step 304: By configuring the update component, based on the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount, and the recommended memory limit amount, detect whether the current CPU request amount, the current memory request amount, the current CPU limit amount, and the current memory limit amount of the target container group meet the corresponding update conditions.
[0129] Step 305: After detecting that the current CPU request, current memory request, current CPU limit or current memory limit of the target container group meets the corresponding update condition by configuring the update component, the current CPU request, current memory request, current CPU limit or current memory limit of the target container group is updated according to the recommended CPU request, recommended memory request, recommended CPU limit or recommended memory limit.
[0130] Step 306: After detecting the restart of the target container group, the container restart component updates the current CPU request, current memory request, current CPU limit, or current memory limit of the target container group according to the latest recommended CPU request, recommended memory request, recommended CPU limit, and recommended memory limit corresponding to the target container group.
[0131] The technical solution of the embodiment of the present invention can periodically obtain the CPU usage and memory usage of the target container group within a preset time before the current moment from the monitoring server, and can continuously determine the CPU request amount, CPU limit amount, memory request amount and memory limit amount suitable for the target container group according to the obtained CPU usage and memory usage of the target container group within the preset time before the current moment. After the target container group is restarted, the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group at the current moment can be automatically updated to the CPU request amount, memory request amount, CPU limit amount and memory limit amount suitable for the target container group, so that during the operation of the application, the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group are automatically configured according to the actual resource usage of the target container group, and the CPU request amount, memory request amount, CPU limit amount and memory limit amount of the target container group at the current moment are continuously updated to the CPU request amount, memory request amount, CPU limit amount and memory limit amount suitable for the target container group, thereby avoiding the beneficial effect of resource waste or insufficient resources allocated to the application in the container group.
[0132] Embodiment 4
[0133] Figure 4 This is a schematic diagram of the structure of a container group configuration device provided in Embodiment 4 of the present invention. The device can be configured in an electronic device. Figure 4 As shown, the device includes: a configuration recommendation module 401, a configuration detection module 402 and a configuration update module 403.
[0134] Among them, the configuration recommendation module 401 is used to periodically obtain the resource usage of the target container group within a preset time period before the current moment through the configuration recommendation component, and determine the recommended resource request amount and the recommended resource limit amount of the target container group according to the resource usage; the configuration detection module 402 is used to detect whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount through the configuration update component according to the recommended resource request amount and the recommended resource limit amount; the configuration update module 403 is used to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update conditions through the configuration update component.
[0135] The technical solution of the embodiment of the present invention configures a recommendation component to periodically obtain the resource usage of the target container group within a preset time period before the current moment, and determines the recommended resource request amount and the recommended resource limit amount of the target container group according to the resource usage; configures an update component to detect whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount according to the recommended resource request amount and the recommended resource limit amount; configures the update component to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update conditions, thereby solving the problem that the container group configuration solution of the related technology cannot reasonably configure the resource request amount and the resource limit amount of the container group where the application is located according to the actual operation situation during the operation of the application. The amount of resources allocated to the application in the container group may lead to a risk of wasting resources or insufficient resources being allocated to the application in the container group. During the operation of the application, the resource request amount and resource limit amount suitable for the container group can be determined according to the resource usage of the container group where the application is located over a period of time at regular intervals. After detecting that the resource request amount and resource limit amount of the container group need to be updated, the resource request amount and resource limit amount of the target container group at the current moment can be automatically updated to the resource request amount and resource limit amount suitable for the target container group. This realizes that during the operation of the application, the resource request amount and resource limit amount of the target container group are automatically configured according to the actual resource usage of the target container group, and the resource request amount and resource limit amount of the target container group at the current moment are continuously updated to the resource request amount and resource limit amount suitable for the target container group, thereby avoiding the beneficial effect of wasting resources or insufficient resources being allocated to the application in the container group.
[0136] In an optional implementation of the embodiment of the present invention, optionally, the resource usage includes a CPU usage and a memory usage, the recommended resource request includes a recommended CPU request and a recommended memory request, the recommended resource limit includes a recommended CPU limit and a recommended memory limit, the current resource request includes a current CPU request and a current memory request, and the current resource limit includes a current CPU limit and a current memory limit; the configuration recommendation module 401 is specifically used to: perform the following operations by configuring the recommendation component: regularly obtain the CPU usage and memory usage of the target container group within a preset time before the current moment; determine the recommended CPU request and recommended CPU limit of the target container group according to the minimum value and maximum value of the CPU usage of the target container group within the preset time before the current moment; determine the recommended memory request and recommended memory limit of the target container group according to the minimum value and maximum value of the memory usage of the target container group within the preset time before the current moment.
[0137] In an optional implementation of an embodiment of the present invention, optionally, the configuration detection module 402 is specifically used to: through the configuration update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount, detect whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions.
[0138] In an optional implementation of an embodiment of the present invention, optionally, when the configuration detection module 402 performs the operation of detecting whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount through the configuration update component, the configuration detection module 402 is specifically used to: perform the following operations through the configuration update component: detect whether the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than a first preset difference; if it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than the first preset difference, determine that the current CPU request amount of the target container group meets the corresponding update conditions; detect the current memory request amount of the target container group and the recommended memory request amount The method further comprises: detecting whether the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference. If it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than the second preset difference, it is determined that the current memory request amount of the target container group meets the corresponding update condition; detecting whether the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount is greater than a third preset difference. If it is detected that the difference between the current CPU limit amount of the target container group and the recommended CPU limit amount is greater than the third preset difference, it is determined that the current CPU limit amount of the target container group meets the corresponding update condition; detecting whether the difference between the current memory limit amount of the target container group and the recommended memory limit amount is greater than a fourth preset difference. If it is detected that the difference between the current memory limit amount of the target container group and the recommended memory limit amount is greater than the fourth preset difference, it is determined that the current memory limit amount of the target container group meets the corresponding update condition.
[0139] In an optional implementation of the embodiment of the present invention, optionally, the configuration update module 403 is specifically used to: perform the following operations through the configuration update component: after detecting that the current CPU request amount of the target container group meets the corresponding update condition, update the current CPU request amount of the target container group to the recommended CPU request amount; after detecting that the current memory request amount of the target container group meets the corresponding update condition, update the current memory request amount of the target container group to the recommended memory request amount; after detecting that the current CPU limit amount of the target container group meets the corresponding update condition, update the current CPU limit amount of the target container group to the recommended CPU limit amount; after detecting that the current memory limit amount of the target container group meets the corresponding update condition, update the current memory limit amount of the target container group to the recommended memory limit amount.
[0140] In an optional implementation of the embodiment of the present invention, optionally, when the configuration recommendation module 401 performs the operation of periodically obtaining the CPU usage and memory usage of the target container group within a preset time period before the current moment, it is specifically used to: periodically obtain the CPU usage and memory usage of the target container group within the preset time period before the current moment from the monitoring server according to a preset time interval.
[0141] In an optional implementation manner of the embodiment of the present invention, optionally, the container group configuration device further includes: a restart configuration module, which is used to update the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group through the container restart component after detecting the restart of the target container group.
[0142] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0143] The above container group configuration device can execute the container group configuration method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the container group configuration method.
[0144] Embodiment 5
[0145] Figure 5 The schematic diagram of the structure of the electronic device 10 that can be used to implement the container group configuration method of the embodiment of the present invention is shown. The components, their connections and relationships, and their functions shown herein are only examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0146] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11 in network communication, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program built from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0147] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0148] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the container group configuration method.
[0149] In some embodiments, the container group configuration method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is built into the RAM 13 and executed by the processor 11, one or more steps of the container group configuration method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the container group configuration method in any other appropriate manner (e.g., by means of firmware).
[0150] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0151] The computer programs for implementing the container group configuration method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0152] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0154] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0155] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0157] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A container group configuration method, characterized in that: include: By configuring the recommendation component, the resource usage of the target container group within a preset time period before the current moment is regularly obtained, and the recommended resource request amount and recommended resource limit amount of the target container group are determined according to the resource usage; By configuring the update component, according to the recommended resource request amount and the recommended resource limit amount, detecting whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount; Through the configuration update component, after detecting that the resource request amount or resource limit amount of the target container group meets the corresponding update condition, the current resource request amount or current resource limit amount of the target container group is updated according to the recommended resource request amount or the recommended resource limit amount.
2. The container group configuration method according to claim 1, characterized in that: The resource usage includes CPU usage and memory usage, the recommended resource request includes a recommended CPU request and a recommended memory request, the recommended resource limit includes a recommended CPU limit and a recommended memory limit, the current resource request includes a current CPU request and a current memory request, and the current resource limit includes a current CPU limit and a current memory limit; By configuring the recommendation component, the resource usage of the target container group within a preset time period before the current moment is periodically obtained, and according to the resource usage, the recommended resource request amount and the recommended resource limit amount of the target container group are determined, including: Configure the recommended components to do the following: Regularly obtain the CPU usage and memory usage of the target container group within a preset time period before the current time; Determine a recommended CPU request and a recommended CPU limit for the target container group according to a minimum value and a maximum value of CPU usage of the target container group within a preset time period before a current moment; A recommended memory request amount and a recommended memory limit amount of the target container group are determined according to a minimum value and a maximum value of memory usage of the target container group within a preset time period before a current moment.
3. The container group configuration method according to claim 2, characterized in that: By configuring the update component, according to the recommended resource request amount and the recommended resource limit amount, detecting whether the current resource request amount and the current resource limit amount of the target container group meet the update conditions corresponding to the current resource request amount and the current resource limit amount, including: By configuring the update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount and the recommended memory limit amount, it is detected whether the current CPU request amount, the current memory request amount, the current CPU limit amount and the current memory limit amount of the target container group meet the corresponding update conditions.
4. The container group configuration method according to claim 3, characterized in that: By configuring the update component, according to the recommended CPU request amount, the recommended memory request amount, the recommended CPU limit amount, and the recommended memory limit amount, detecting whether the current CPU request amount, the current memory request amount, the current CPU limit amount, and the current memory limit amount of the target container group meet corresponding update conditions, including: Perform the following operations by configuring the update component: Detecting whether a difference between a current CPU request amount of the target container group and the recommended CPU request amount is greater than a first preset difference, and if it is detected that the difference between the current CPU request amount of the target container group and the recommended CPU request amount is greater than the first preset difference, determining that the current CPU request amount of the target container group meets a corresponding update condition; Detecting whether a difference between a current memory request amount of the target container group and the recommended memory request amount is greater than a second preset difference; if it is detected that the difference between the current memory request amount of the target container group and the recommended memory request amount is greater than the second preset difference, determining that the current memory request amount of the target container group meets a corresponding update condition; Detecting whether a difference between a current CPU limit of the target container group and the recommended CPU limit is greater than a third preset difference, and if it is detected that the difference between the current CPU limit of the target container group and the recommended CPU limit is greater than the third preset difference, determining that the current CPU limit of the target container group meets a corresponding update condition; Detect whether a difference between a current memory limit of the target container group and the recommended memory limit is greater than a fourth preset difference; if it is detected that the difference between the current memory limit of the target container group and the recommended memory limit is greater than the fourth preset difference, determine that the current memory limit of the target container group meets the corresponding update condition.
5. The container group configuration method according to claim 4, characterized in that: After detecting, by the configuration update component, that the resource request amount or the resource limit amount of the target container group meets the corresponding update condition, updating the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount, includes: The configuration update component performs the following operations: After detecting that the current CPU request amount of the target container group meets the corresponding update condition, updating the current CPU request amount of the target container group to the recommended CPU request amount; After detecting that the current memory request amount of the target container group meets the corresponding update condition, updating the current memory request amount of the target container group to the recommended memory request amount; After detecting that the current CPU limit of the target container group meets the corresponding update condition, updating the current CPU limit of the target container group to the recommended CPU limit; After detecting that the current memory limit of the target container group meets the corresponding update condition, the current memory limit of the target container group is updated to the recommended memory limit.
6. The container group configuration method according to claim 2, characterized in that: Periodically obtain the CPU usage and memory usage of the target container group within a preset time before the current time, including: According to the preset time interval, the CPU usage and memory usage of the target container group within the preset time period before the current moment are obtained from the monitoring server on a regular basis.
7. The container group configuration method according to claim 1, characterized in that: Also includes: After detecting the restart of the target container group, the container restart component updates the current resource request amount and the current resource limit amount of the target container group according to the latest recommended resource request amount and the recommended resource limit amount corresponding to the target container group.
8. A container group configuration device, characterized in that: include: A configuration recommendation module is used to periodically obtain the resource usage of the target container group within a preset time period before the current moment by configuring a recommendation component, and determine the recommended resource request amount and recommended resource limit amount of the target container group according to the resource usage; A configuration detection module, configured to detect, by configuring an update component, whether a current resource request amount and a current resource limit amount of the target container group meet an update condition corresponding to the current resource request amount and the current resource limit amount according to the recommended resource request amount and the recommended resource limit amount; A configuration update module is used to update the current resource request amount or the current resource limit amount of the target container group according to the recommended resource request amount or the recommended resource limit amount through the configuration update component after detecting that the resource request amount or the resource limit amount of the target container group meets the corresponding update condition.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory connected in network communication with the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the container group configuration method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the container group configuration method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Recommended resource reading method and device, electronic equipment and storage medium
CN116049026A
Resource recommendation method and device, electronic equipment and storage medium
CN116450901A