Resource adjustment method, apparatus, device, medium, and computer program product

CN117009080BActive Publication Date: 2026-10-30ANCHAO CLOUD SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310966589.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-02
Publication Date
2026-10-30
Estimated Expiration
2043-08-02

AI Technical Summary

Technical Problem

[0003]传统技术中,一般通过调整应用程序的副本数量或者调整应用程序的资源规格进行弹性扩缩容,但上述方法都涉及到应用程序的重新创建,而重新创建的应用程序在重新启动时需要恢复时间,所以在当应用程序的负载资源使用率达到第一阈值时,若突然出现大量的新的资源需求请求,应用程序所在的系统是难以及时响应新的资源需求请求并迅速提供所需资源的,导致系统调整资源的能力低下

Benefits of technology

[0033]上述资源调整方法、装置、设备、介质和计算机程序产品,实时获取应用程序的负载资源使用率和程序标识;确定负载资源使用率是否大于应用程序的预设资源使用率第一阈值,在负载资源使用率大于预设资源使用率第一阈值的情况下,根据程序标识,从预存的且处于待使用状态的备用资源中调取至少一个与程序标识对应的目标备用资源,并将目标备用资源从待使用状态转换为使用状态,直至负载资源使用率降低至预设资源使用率第一阈值以下。本申请采用上述方法,在应用程序的负载资源使用率大于对应的预设资源使用率第一阈值时,将与程序标识对应的备用资源的状态从待使用状态转换为使用状态,以便为应用程序的运行需求提供更多的资源,从而在资源需求峰值来临时,能快速响应资源需求,且无需重新启动应用程序,进而提升系统调整资源的能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117009080B_ABST
    Figure CN117009080B_ABST
Patent Text Reader

Abstract

The application relates to a resource adjustment method, device, equipment, medium and computer program product. The method comprises the following steps: acquiring a load resource usage rate and a program identifier of an application program in real time; determining whether the load resource usage rate is greater than a preset resource usage rate first threshold value of the application program; in the case that the load resource usage rate is greater than the preset resource usage rate first threshold value, calling at least one target standby resource corresponding to the program identifier from a pre-stored standby resource in a standby use state according to the program identifier, and converting the target standby resource from the standby use state to a use state until the load resource usage rate is reduced to below the preset resource usage rate first threshold value. The application adopts the above method, can quickly respond to resource demand when a resource demand peak arrives, does not need to restart the application program, and helps to improve the resource adjustment capability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a resource adjustment method, apparatus, device, medium, and computer program product. Background Technology

[0002] Kubernetes is an open-source system that can automatically deploy, scale, and manage applications. It can run on various cloud servers, physical machines, and other nodes. When the system's load resource utilization is too high or too low, Kubernetes can enable automatic scaling of applications across multiple nodes.

[0003] Traditional technologies typically achieve elastic scaling by adjusting the number of application replicas or the application's resource specifications. However, both of these methods involve recreating the application, and the recreated application requires recovery time upon restart. Therefore, when the application's load resource utilization reaches the first threshold, if a large number of new resource requests suddenly appear, the system hosting the application will find it difficult to respond to the new resource requests in a timely manner and quickly provide the required resources, resulting in a poor ability of the system to adjust resources. Summary of the Invention

[0004] Therefore, it is necessary to provide a resource adjustment method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the system's resource adjustment capabilities in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a resource adjustment method. The method includes:

[0006] Real-time acquisition of application load resource utilization and application identifier;

[0007] Determine whether the load resource utilization rate is greater than the application's preset resource utilization first threshold. If the load resource utilization rate is greater than the preset resource utilization first threshold, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the usage state until the load resource utilization rate is reduced to below the preset resource utilization first threshold.

[0008] In one embodiment, based on a program identifier, retrieving at least one target backup resource corresponding to the program identifier from pre-stored backup resources that are in a state of being ready for use includes:

[0009] Obtain the location information of the application's running terminal and the location information of pre-stored, ready-to-use backup resources;

[0010] Based on the location information of the running terminal and the location information of the backup resources corresponding to the program identifier, the candidate backup resources are determined, and the target backup resources are determined based on the distribution density of the candidate backup resources. The distribution density is used to characterize the number of candidate backup resources distributed in the same running terminal relative to the backup resources corresponding to other program identifiers.

[0011] In one embodiment, a candidate backup resource is determined based on the location information of the running terminal and the location information of the backup resource corresponding to the program identifier, and a target backup resource is determined based on the distribution density of the candidate backup resources, including:

[0012] The backup resources whose location information is inconsistent with the location information of the running terminal and which correspond to the program identifier are identified as candidate backup resources.

[0013] Obtain the distribution density of the candidate backup resources in each of the other running terminals corresponding to the program identifier, and determine the candidate backup resource corresponding to the maximum distribution density as the target backup resource.

[0014] In one embodiment, after the load resource utilization rate decreases to below a preset first threshold, the method further includes:

[0015] Get the remaining quantity of standby resources that are currently in a state of being unused;

[0016] When the remaining quantity is less than the preset reserve resource threshold, additional resources are added so that the sum of the additional resources and the remaining quantity reaches the reserve resource threshold.

[0017] In one embodiment, the method further includes:

[0018] When the remaining number of backup resources is greater than the preset backup resource threshold, the location information of the application's running terminal is obtained. Based on the location information of the running terminal, the backup resources corresponding to the location information of the running terminal are obtained. The backup resources are gradually deleted from high to low according to the distribution density of the backup resources in the other running terminals corresponding to the program identifier, until the remaining number of backup resources is equal to the preset backup resource threshold. The distribution density is used to characterize the distribution number of the candidate backup resources relative to the backup resources corresponding to other program identifiers in the same running terminal.

[0019] In one embodiment, the method further includes:

[0020] If the load resource utilization rate is less than the preset first threshold, determine whether the load resource utilization rate is less than the preset second threshold corresponding to the program identifier. If the load resource utilization rate is less than the preset second threshold, convert the corresponding resources in use to standby resources in the waiting state in order of load resource utilization rate from low to high.

[0021] Secondly, this application also provides a resource adjustment device. The device includes:

[0022] The data acquisition module is used to acquire the application's load resource utilization and application identifier in real time;

[0023] The resource adjustment module is used to determine whether the load resource utilization rate is greater than the application's preset resource utilization rate first threshold. If the load resource utilization rate is greater than the preset resource utilization rate first threshold, at least one target backup resource corresponding to the program identifier is retrieved from the pre-stored backup resources that are in the standby state, and the target backup resource is changed from the standby state to the usage state until the load resource utilization rate is reduced to below the preset resource utilization rate first threshold.

[0024] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0025] Real-time acquisition of application load resource utilization and application identifier;

[0026] Determine whether the load resource utilization rate is greater than the application's preset resource utilization first threshold. If the load resource utilization rate is greater than the preset resource utilization first threshold, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the usage state until the load resource utilization rate is reduced to below the preset resource utilization first threshold.

[0027] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0028] Real-time acquisition of application load resource utilization and application identifier;

[0029] Determine whether the load resource utilization rate is greater than the application's preset resource utilization first threshold. If the load resource utilization rate is greater than the preset resource utilization first threshold, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the usage state until the load resource utilization rate is reduced to below the preset resource utilization first threshold.

[0030] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0031] Real-time acquisition of application load resource utilization and application identifier;

[0032] Determine whether the load resource utilization rate is greater than the application's preset resource utilization first threshold. If the load resource utilization rate is greater than the preset resource utilization first threshold, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the usage state until the load resource utilization rate is reduced to below the preset resource utilization first threshold.

[0033] The aforementioned resource adjustment method, apparatus, device, medium, and computer program product acquire the application's load resource utilization rate and program identifier in real time; determine whether the load resource utilization rate is greater than a preset first threshold for resource utilization of the application; if the load resource utilization rate is greater than the preset first threshold, based on the program identifier, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources in a ready-to-use state, and change the target backup resource from a ready-to-use state to a used state until the load resource utilization rate drops below the preset first threshold. This application employs the above method, which, when the application's load resource utilization rate is greater than the corresponding preset first threshold, changes the state of the backup resource corresponding to the program identifier from a ready-to-use state to a used state, in order to provide more resources for the application's operational needs. This allows for rapid response to resource demands during peak resource demand periods without restarting the application, thereby improving the system's resource adjustment capabilities. Attached Figure Description

[0034] Figure 1 This is a diagram illustrating the application environment of a resource adjustment method in one embodiment.

[0035] Figure 2 Here is a flowchart of a resource adjustment method in one embodiment;

[0036] Figure 3 This is a flowchart for determining a target backup resource in one embodiment;

[0037] Figure 4 This is a flowchart illustrating the determination of a target backup resource based on the location information and dispersion density of backup resources in one embodiment.

[0038] Figure 5 This is a flowchart in one embodiment for determining whether to add supplementary resources based on the remaining quantity of spare resources;

[0039] Figure 6 This is a structural block diagram of a resource adjustment device in one embodiment;

[0040] Figure 7 This is an internal structural diagram of a computer device in one embodiment;

[0041] Figure 8 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0043] The resource adjustment method provided in this application is a method for expanding or shrinking system resources, and can be applied to, for example... Figure 1 The application environment shown is illustrated. Terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Terminal 102 stores multiple containerized applications and system resources. When the system load is too high, resources can be increased to meet the demand through scaling up, including increasing the number of servers, increasing computing power, or increasing storage space. When the system load is low, resource usage can be reduced through scaling down to save costs, including shutting down some servers, reducing computing power, or freeing up storage space. Load resource adjustments are typically automated. This application embodiment can monitor load resource utilization in real time based on the Kubernetes platform, simplifying and optimizing the deployment, management, and scaling of containerized applications. This ensures the system can dynamically adjust resources according to application runtime requirements, achieving efficient resource utilization. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0044] In one embodiment, such as Figure 2 As shown, this method is applied to Figure 1 Taking a terminal as an example, it can be understood that this method can also be applied to a server, and to a system that includes both a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0045] Step 202: Obtain the application's load resource utilization and application identifier in real time.

[0046] In this embodiment, the application is a containerized application. A containerized application uses container technology to package the application and its dependencies into an independent and portable runtime environment. The containerized application uses a container runtime to create and manage containers. Each container is an independently running application instance, i.e., an application copy. Each container has its own file system, process space, and network interface. Therefore, the application can run on any system that supports container operation. Each application is an independent container image, which includes the application's code, runtime environment, and dependencies. In this way, different applications can coexist on the running terminal and be isolated from each other.

[0047] Resource utilization refers to the degree to which computer equipment (such as servers, hosts, etc.) or service resources (such as CPU, memory, disk, network bandwidth, etc.) are utilized within a specific time period. By understanding the level of resource utilization, we can understand the usage of system resources, thus facilitating the evaluation of system efficiency and performance. Resource utilization can be expressed in different ways. Depending on the specific resource type and monitoring tools, common methods for measuring resource utilization include: CPU utilization, memory utilization, disk utilization, and network bandwidth utilization. By obtaining real-time resource utilization data, the running status of applications can be monitored. A program identifier is a unique identifier used to characterize a program. It verifies the corresponding application. The program identifier can be the program name or program number; for example, an application might be named "Graphic Design Software," or its program number might be A001.

[0048] Step 204: Determine whether the load resource utilization rate is greater than the application's preset resource utilization rate first threshold. If the load resource utilization rate is greater than the preset resource utilization rate first threshold, according to the program identifier, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the use state until the load resource utilization rate is reduced to below the preset resource utilization rate first threshold.

[0049] The preset resource utilization first threshold is an upper limit for load resource utilization set based on historical experience, actual needs, and application characteristics. This threshold characterizes the maximum load an application can withstand under normal operating conditions. When load resource utilization exceeds this threshold, issues such as insufficient resource supply, prolonged response time, decreased system performance, or even system crashes may occur, impacting system stability. Backup resources are backup application instances or copies, initially in a ready-to-use state. In this embodiment, the backup resource is a paused pod, the smallest deployment unit in Kubernetes, which can include one or more containers and shared storage, network, and other resources. A pod can be analogous to a process in a system, and pods can be created, destroyed, scheduled, scaled up, and scaled down as needed.

[0050] Furthermore, pods are typically deployed on nodes within a cluster. A cluster can be a group of connected physical or virtual machines, and can contain multiple topologies. Topologies can be divided according to the geographical location of the nodes, and each topology can contain multiple physical or virtual machines. Nodes in the cluster are the worker machines, typically the hosts that actually run containers and host applications. Each node consists of an operating system, Kubernetes runtime components, and other necessary tools. There are two main types of nodes: master nodes and worker nodes. Master nodes are responsible for managing and coordinating all nodes in the cluster, including the following core components: Kubernetes API Server (providing API interfaces for controlling and managing the entire cluster), etcd (a distributed key-value store used to persist cluster configuration data), Kubernetes Controller Manager (responsible for handling various resources in the cluster, ensuring that the expected state of the cluster is consistent with the actual state), and Kubernetes Scheduler (responsible for scheduling pods to run on appropriate nodes). Worker nodes are the compute nodes in the cluster, used to run application containers.

[0051] Nodes in a cluster host the actual applications and containers, providing resources such as CPU, memory, network, and storage. Kubernetes distributes these resources among the nodes to achieve high availability, scalability, and elasticity for applications. Specifically, in Kubernetes, the resource requirements of an application are met by scaling up or down the number of pods. This scaling up and down can be automatically adjusted based on CPU utilization and memory utilization. In this embodiment, the resource utilization rate can be either CPU utilization or memory utilization. For example, when the application is a web application, the corresponding preset first threshold for resource utilization is 80%, meaning the upper limit for CPU utilization is 80%, or the upper limit for memory utilization is 80%. In this embodiment, the backup resources are pre-stored and correspond to specific program identifiers. That is, different applications will pre-store a certain amount of backup resources. The amount of backup resources pre-stored is customized according to actual operating needs and the operating characteristics of the application. For example, the number of backup resources pre-stored for a web application is not less than 20% of the total amount of all resources corresponding to the web application. By timely scheduling and activating the pre-stored backup resources when the load resource utilization rate reaches the preset first threshold of resource utilization rate, the load resource demand can be responded to in a timely manner, thereby ensuring the stable operation of the application and the system.

[0052] For example, when the load resource utilization rate is greater than a preset first threshold, such as when the CPU utilization rate is greater than 80%, the application's program identifier is obtained. When the obtained program identifier is a web application, at least one target backup resource corresponding to the web application is retrieved from the pre-stored backup resources that are in a standby state. The status of the target backup resource is changed from a standby state to a used state, that is, the paused pod is changed to a running pod, until the load resource utilization rate is reduced to below 80%.

[0053] In the above resource adjustment method, when the application's load resource utilization rate is greater than the corresponding preset first threshold of resource utilization rate, the status of the standby resource corresponding to the program identifier is changed from the standby state to the used state, so as to provide more resources for the application's running needs. This allows for a quick response to resource demands when resource demand peaks, without having to restart the application, thereby improving the system's ability to adjust resources.

[0054] In one embodiment, such as Figure 3 As shown, based on the program identifier, at least one target backup resource corresponding to the program identifier is retrieved from the pre-stored backup resources that are in a state of being ready for use, including:

[0055] Step 302: Obtain the location information of the application's running terminal and the location information of the pre-stored, ready-to-use backup resources.

[0056] For example, as described above, the application's running terminal can be a host in the cluster. The location information of the running terminal is the topology domain information to which the running terminal belongs. The topology domain information can be represented by a topology location name or a topology location number. For example, multiple hosts in the same data center belong to the same topology domain, which is the location of the data center. The topology location name of the topology domain can be A cluster A1 data center, or the topology location number of the topology domain can be A-A1, indicating that the corresponding topology domain information is A cluster A1 data center. The location information of pre-stored and ready-to-use backup resources is the storage location information of the backup resources. The location information of pre-stored and ready-to-use backup resources can be the topology domain information to which the running terminal storing the backup resources belongs. For example, if multiple hosts in A cluster A1 data center store a certain backup resource, then the location information of the backup resource is A cluster A1 data center.

[0057] Step 304: Based on the location information of the running terminal and the location information of the backup resources corresponding to the program identifier, determine the candidate backup resources, and based on the dispersion density of the candidate backup resources, determine the target backup resources. The dispersion density is used to characterize the number of candidate backup resources distributed in the same running terminal relative to the backup resources corresponding to other program identifiers.

[0058] For example, after obtaining the location information of the application's running terminal and the location information of the backup resources, the candidate backup resources are first determined, and then the target backup resources are determined based on the distribution density of the candidate backup resources, thereby ensuring the accuracy of the selection of the target backup resources.

[0059] In this embodiment, the target backup resource is determined based on the location information of the backup resource and the distribution density of the backup resource in each operating terminal, thereby ensuring the accuracy of the selection of the target backup resource.

[0060] In one embodiment, such as Figure 4 As shown, based on the location information of the running terminal and the location information of the backup resources corresponding to the program identifier, candidate backup resources are determined, and based on the distribution density of the candidate backup resources, target backup resources are determined, including:

[0061] Step 402: The backup resources whose location information is inconsistent with the location information of the running terminal and which correspond to the program identifier are identified as candidate backup resources.

[0062] For example, when all backup resources corresponding to an application are located in the same topology domain (i.e., all application instance pods are located in the same topology domain), if that topology domain fails or becomes unavailable, all application instances will be affected, causing the entire application to malfunction. When application instance pods are distributed across different topology domains, even if one topology domain fails, application instance pods in other topology domains can continue to provide services. Therefore, to increase the high availability and fault tolerance of applications, backup resources are typically distributed and stored in different topology domains, providing better fault isolation and disaster recovery capabilities and avoiding the impact of single points of failure. Therefore, after obtaining the location information of each backup resource in the system, backup resources whose location information is inconsistent with that of the running terminal are identified as candidate backup resources.

[0063] Step 404: Obtain the distribution density of the candidate backup resources in the other running terminals corresponding to the program identifier, and determine the candidate backup resource corresponding to the maximum distribution density as the target backup resource.

[0064] As mentioned above, distribution density characterizes the number of candidate backup resources distributed across the same running terminal relative to backup resources corresponding to other program identifiers. To avoid performance degradation due to overload of a single running terminal, and to ensure system scalability and application high availability and fault tolerance, the number of backup resources on each running terminal must be approximately equal when calling backup resources, i.e., the number of pods must be approximately equal. Therefore, backup resources are often called from the running terminal with the highest backup resource distribution density to achieve load balancing. It is worth noting that if the utilization rate of the load resources is still higher than the preset first threshold after the status of the backup resource with the highest distribution density is changed from the unused state to the used state, then the status of the backup resources is sequentially changed from the unused state to the used state according to the backup resource distribution density from high to low, until the utilization rate of the load resources drops below the preset first threshold.

[0065] For example, the dispersion density of the candidate backup resource in each of the other running terminals corresponding to the program identifier is obtained. For instance, if the first running terminal, the second running terminal, and the third running terminal in the cluster are not within the topology domain of the running terminal where the application is located, and the dispersion density of the candidate backup resource in the first running terminal is 20%, the dispersion density of the candidate backup resource in the second running terminal is 40%, and the dispersion density of the candidate backup resource in the third running terminal is 45%, then the candidate backup resource corresponding to the program identifier in the third running terminal is determined as the target backup resource because the dispersion density of the candidate backup resource in the third running terminal is the largest.

[0066] In this embodiment, the backup resources whose location information is inconsistent with the location information of the running terminal where the application is located are first identified as candidate backup resources, and then the candidate backup resources with the highest dispersion density are identified as target backup resources. This reduces the load utilization rate while helping to ensure the normal operation of the application.

[0067] In one embodiment, such as Figure 5 As shown, after the load resource utilization rate decreases to below the preset first threshold of resource utilization, the following steps are also included:

[0068] Step 502: Obtain the remaining quantity of standby resources that are currently in a standby state.

[0069] For example, in order to ensure the availability and fault tolerance of the system, the remaining number of backup resources, i.e. the remaining number of paused pods, cannot be too small. Therefore, after the load resource utilization rate drops below the preset first threshold of resource utilization, the remaining number of backup resources that are currently in the standby state is obtained.

[0070] Step 504: When the remaining quantity is less than the preset reserve resource threshold, add supplementary resources so that the sum of the supplementary resources and the remaining quantity reaches the reserve resource threshold.

[0071] The preset standby resource threshold is set according to the application's operating requirements, and the preset standby resource threshold represents the minimum amount of standby resource storage.

[0072] For example, when the remaining number of backup resources corresponding to the program identifier is less than a preset backup resource threshold, such as a web application whose preset backup resource threshold is 20%, meaning that the number of backup resources for the web application is not less than 20% of the total number of all resources corresponding to the web application, including resources in use (running pods) and backup resources (paused pods), the system adds supplementary resources. These supplementary resources can be automatically generated by the aforementioned master node Kubernetes Controller Manager and Kubernetes Scheduler according to the application's preset deployment strategy. In Kubernetes, deployment policies are objects used to define and manage pods. Their primary purpose is to ensure applications are deployed as needed, guaranteeing availability, stability, and scalability. The Kubernetes Controller Manager monitors the status of various resource objects in the cluster and takes appropriate actions. When resources need to be added according to the application's deployment policy, the Kubernetes Controller Manager checks the current resource status based on the number of replicas defined in the deployment policy and performs corresponding operations to create new spare resources, i.e., new pod resources. The Kubernetes Scheduler is responsible for allocating pods to nodes in the cluster for operation. When additional resources are needed, the Kubernetes Scheduler selects suitable nodes based on the requirements of the deployment policy, such as the number of replicas, and schedules the new pods to these nodes. This allows the newly added spare resources to be utilized, meeting the application's operational needs.

[0073] In this embodiment, when the remaining quantity is less than the preset reserve resource threshold, supplementary resources are added in a timely manner to ensure that the quantity of reserve resources reaches the reserve resource threshold, thereby ensuring the availability and scalability of the application, and thus ensuring the fault tolerance and stability of the system.

[0074] In one embodiment, the method further includes:

[0075] When the remaining number of backup resources is greater than the preset backup resource threshold, the location information of the application's running terminal is obtained. Based on the location information of the running terminal, the backup resources corresponding to the location information of the running terminal are obtained. The backup resources are gradually deleted from high to low according to the distribution density of the backup resources in the other running terminals corresponding to the program identifier, until the remaining number of backup resources is equal to the preset backup resource threshold. The distribution density is used to characterize the distribution number of the candidate backup resources relative to the backup resources corresponding to other program identifiers in the same running terminal.

[0076] For example, when the remaining number of spare resources is greater than the preset spare resource threshold, it indicates that there are many idle spare resources in the system. In this case, in order to reduce system memory, idle spare resources can be deleted. Since areas with higher distribution density indicate higher resource utilization in those areas, when deleting spare resources, they can be gradually deleted from high to low according to the distribution density to reduce resource waste. However, considering the need to ensure the fault tolerance and stability of the system, when deleting idle spare resources, it is necessary to ensure that the remaining number of spare resources is equal to the preset spare resource threshold.

[0077] In this embodiment, when the remaining number of backup resources is greater than a preset backup resource threshold, the idle backup resources are deleted, thereby reducing system resource waste and saving memory space.

[0078] In one embodiment, the method further includes: if the load resource utilization rate is less than a preset first threshold of resource utilization rate, determining whether the load resource utilization rate is less than a preset second threshold of resource utilization rate corresponding to the program identifier; if the load resource utilization rate is less than the preset second threshold of resource utilization rate, then converting the corresponding resources in use to standby resources in standby state in order of load resource utilization rate from low to high.

[0079] The preset second threshold for resource utilization is a lower limit set based on historical experience, actual needs, and application characteristics. This threshold characterizes the minimum load an application can withstand under normal operating conditions. A low resource utilization rate indicates a lighter load or lower resource consumption. Converting low-load, running resources to standby status allows the freed-up resources to be used for higher-priority tasks or provided to heavier application instances, thus improving application responsiveness. Therefore, when the resource utilization rate is less than the preset second threshold, resources in use are sequentially converted to standby status in ascending order of utilization.

[0080] For example, when the load resource utilization rate is less than a preset first threshold, it is determined whether the load resource utilization rate is less than a preset second threshold corresponding to the program identifier. For instance, if the first threshold for the load resource utilization rate of a web application is 80% and the second threshold is 20%, then when the load resource utilization rate of the web application is less than 80%, it is determined whether the load resource utilization rate of the web application is less than 20%. If the load resource utilization rate of the web application is less than 20%, the load resource utilization rate of each resource in each running terminal is obtained, and the corresponding resources in use are converted to standby resources in a waiting state according to the load resource utilization rate from low to high. For example, the CPU utilization rate of each resource in each running terminal is obtained, and the corresponding running pods in use are converted to paused according to the CPU utilization rate from low to high. In order to ensure system stability, the number of resources in use must not be less than a preset resource threshold. For example, a web application needs to retain at least three replica resources to run stably. When the resource utilization rate of the web application is less than 20%, if there are five replica resources corresponding to the web application that are in use, then at most two replica resources can be changed from the use state to the standby state. Resources changed to the standby state can become standby resources.

[0081] In this embodiment, when the load resource utilization rate is less than the preset second threshold of resource utilization rate, the corresponding resources in use are converted into standby resources in the waiting state in order of load resource utilization rate from low to high, thereby saving system memory and reducing resource waste.

[0082] This embodiment uses the above method to change the status of the backup resource corresponding to the program identifier from the waiting state to the used state when the application's load resource utilization rate is greater than the corresponding preset first threshold of resource utilization rate. This provides more resources for the application's running needs, so that when the resource demand peaks, it can quickly respond to the resource demand without restarting the application, thereby improving the system's ability to adjust resources.

[0083] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0084] Based on the same inventive concept, this application also provides a resource adjustment apparatus for implementing the resource adjustment method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more resource adjustment apparatus embodiments provided below can be found in the limitations of the resource adjustment method described above, and will not be repeated here.

[0085] In one embodiment, such as Figure 6 As shown, a resource adjustment device is provided, including: a data acquisition module 602 and a resource adjustment module 604, wherein:

[0086] The data acquisition module 602 is used to acquire the application's load resource utilization and application identifier in real time;

[0087] The resource adjustment module 604 is used to determine whether the load resource utilization rate is greater than the preset resource utilization rate first threshold of the application. If the load resource utilization rate is greater than the preset resource utilization rate first threshold, then according to the program identifier, at least one target backup resource corresponding to the program identifier is retrieved from the pre-stored backup resources that are in the standby state, and the target backup resource is changed from the standby state to the use state until the load resource utilization rate is reduced to below the preset resource utilization rate first threshold.

[0088] In one embodiment, the resource adjustment module 604 is further configured to: obtain the location information of the application's running terminal and the location information of pre-stored standby resources that are in a state of being ready for use; determine the candidate standby resources based on the location information of the running terminal and the location information of the standby resources corresponding to the program identifier, and determine the target standby resources based on the dispersion density of the candidate standby resources, wherein the dispersion density is used to characterize the number of candidate standby resources distributed in the same running terminal relative to the standby resources corresponding to other program identifiers.

[0089] In one embodiment, the resource adjustment module 604 is further configured to: determine the backup resources whose location information is inconsistent with the location information of the running terminal and which correspond to the program identifier as candidate backup resources; obtain the dispersion density of the candidate backup resources in the other running terminals corresponding to the program identifier, and determine the candidate backup resource corresponding to the maximum dispersion density as the target backup resource.

[0090] In one embodiment, the device is further configured to: obtain the remaining quantity of standby resources currently in a standby state; and when the remaining quantity is less than a preset standby resource threshold, add supplementary resources so that the sum of the quantity of supplementary resources and the remaining quantity reaches the standby resource threshold.

[0091] In one embodiment, the apparatus is further configured to: when the remaining number of backup resources is greater than a preset backup resource threshold, obtain the location information of the running terminal of the application, obtain the backup resources corresponding to the location information of the running terminal according to the location information of the running terminal, and gradually delete the backup resources from high to low according to the dispersion density of the backup resources in the other running terminals corresponding to the program identifier, until the remaining number of backup resources is equal to the preset backup resource threshold, wherein the dispersion density is used to characterize the distribution number of the candidate backup resources relative to the backup resources corresponding to other program identifiers in the same running terminal.

[0092] In one embodiment, the device is further configured to: if the load resource utilization rate is less than a preset first threshold of resource utilization rate, determine whether the load resource utilization rate is less than a preset second threshold of resource utilization rate corresponding to the program identifier; if the load resource utilization rate is less than the preset second threshold of resource utilization rate, convert the corresponding resources in use to standby resources in standby state in order of load resource utilization rate from low to high.

[0093] Each module in the aforementioned resource adjustment device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0094] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores application-related data, spare resource data, and data related to the running terminals of the applications. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a resource adjustment method.

[0095] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a resource adjustment method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0096] Those skilled in the art will understand that Figure 7 and Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0097] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0098] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0099] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0100] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0101] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0102] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0103] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A resource adjustment method, characterized in that, The method includes: Real-time acquisition of application load resource utilization and application identifier; Determine whether the load resource utilization rate is greater than the preset resource utilization rate first threshold of the application. If the load resource utilization rate is greater than the preset resource utilization rate first threshold, according to the program identifier, retrieve at least one target backup resource corresponding to the program identifier from the pre-stored backup resources that are in the standby state, and change the target backup resource from the standby state to the use state until the load resource utilization rate is reduced to below the preset resource utilization rate first threshold. Specifically, retrieving at least one target backup resource corresponding to the program identifier from pre-stored backup resources that are in a state of readiness includes: Obtain the location information of the terminal on which the application is running and the location information of the pre-stored, ready-to-use backup resources; Based on the location information of the running terminal and the location information of the backup resource corresponding to the program identifier, a candidate backup resource is determined, and based on the dispersion density of the candidate backup resource, the target backup resource is determined, wherein the dispersion density is used to characterize the number of candidate backup resources distributed in the same running terminal relative to the backup resources corresponding to other program identifiers.

2. The method according to claim 1, characterized in that, The step of determining candidate backup resources based on the location information of the running terminal and the location information of the backup resources corresponding to the program identifier, and determining the target backup resource based on the distribution density of the candidate backup resources, includes: The backup resource that is inconsistent with the location information of the running terminal and corresponds to the program identifier is determined as the candidate backup resource; Obtain the dispersion density of the candidate backup resources in each of the other running terminals corresponding to the program identifier, and determine the candidate backup resource corresponding to the largest dispersion density as the target backup resource.

3. The method according to claim 1, characterized in that, After the load resource utilization rate decreases to below the preset first threshold value, the method further includes: Obtain the remaining quantity of the standby resources that are currently in a state of being available for use; When the remaining quantity is less than a preset reserve resource threshold, additional resources are added so that the sum of the additional resources and the remaining quantity reaches the reserve resource threshold.

4. The method according to claim 3, characterized in that, The method further includes: When the remaining number of backup resources is greater than a preset backup resource threshold, the location information of the running terminal of the application is obtained. Based on the location information of the running terminal, the backup resources corresponding to the location information of the running terminal are obtained. The backup resources are gradually deleted from high to low according to the distribution density of the backup resources in the other running terminals corresponding to the program identifier, until the remaining number of backup resources is equal to the preset backup resource threshold. The distribution density is used to characterize the distribution number of the candidate backup resources relative to the backup resources corresponding to other program identifiers in the same running terminal.

5. The method according to claim 1, characterized in that, The method further includes: If the load resource utilization rate is less than the preset first threshold of resource utilization rate, it is determined whether the load resource utilization rate is less than the preset second threshold of resource utilization rate corresponding to the program identifier. If the load resource utilization rate is less than the preset second threshold of resource utilization rate, the corresponding resources in use are converted into standby resources in standby state in order of load resource utilization rate from low to high.

6. A resource adjustment device, characterized in that, The device includes: The data acquisition module is used to acquire the application's load resource utilization and application identifier in real time; The resource adjustment module is used to determine whether the load resource utilization rate is greater than the preset resource utilization rate first threshold of the application. If the load resource utilization rate is greater than the preset resource utilization rate first threshold, according to the program identifier, at least one target backup resource corresponding to the program identifier is retrieved from the pre-stored backup resources that are in the standby state, and the target backup resource is changed from the standby state to the use state until the load resource utilization rate is reduced to below the preset resource utilization rate first threshold. The resource adjustment module is used to obtain the location information of the running terminal of the application and the location information of the pre-stored backup resources that are in a state of being ready for use; determine the candidate backup resources according to the location information of the running terminal and the location information of the backup resources corresponding to the program identifier, and determine the target backup resources according to the dispersion density of the candidate backup resources, wherein the dispersion density is used to characterize the distribution quantity of the candidate backup resources relative to the backup resources corresponding to other program identifiers in the same running terminal.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Resource management method and device of Docker container

    CN105912403A

  • Resource expansion method and resource expansion device

    CN107204870A