Resource adjustment method and device, equipment and storage medium
By acquiring host machine monitoring metrics, determining load status, and adjusting over-provisioning ratio, the problem of host machine CPU resource shortage and performance degradation was solved, achieving adaptive resource adjustment and improving CPU utilization and host machine performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2025-12-04
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, the artificially conservative setting of the host machine's CPU over-provisioning ratio leads to resource shortages and degraded business performance, making it impossible to respond in time to surges in CPU utilization, resulting in resource contention and performance degradation.
By acquiring host machine monitoring metrics, the load status is determined, and the target overload ratio is adjusted to optimize resource allocation when the load is not excessive. When the load is excessive, virtual machine migration is performed to achieve adaptive resource adjustment.
It improves CPU utilization, avoids resource contention, ensures host performance, and increases the economic benefits of the data center.
Smart Images

Figure CN121918985A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of cloud computing, specifically relating to a resource adjustment method and apparatus, an electronic device, and a storage medium. Background Technology
[0002] To improve utilization, data centers often over-allocate resources, meaning the total resources allocated to tasks on a machine exceed the machine's physical capacity. In existing network resource pools, the over-allocation ratio of host machine CPUs (Central Processing Units) is usually determined manually.
[0003] To avoid resource contention caused by CPU over-provisioning on the host machine, the CPU over-provisioning ratio is often set conservatively. This results in a smaller amount of CPU resources that the host machine can provide, leading to a shortage of allocable CPU resources in the live network environment and an inability to adjust in a timely manner according to the actual situation of the host machine. In the event of a sudden surge in CPU utilization, it is also unable to respond in time, resulting in continuous resource contention and service performance degradation within the host machine. Summary of the Invention
[0004] The purpose of this application is to provide a resource adjustment method that can solve or at least partially solve the problems of scarce CPU allocable resources and degraded host service performance caused by artificially conservatively set fixed host CPU over-provisioning ratio.
[0005] Accordingly, embodiments of this application also provide a resource adjustment device, an electronic device, and a storage medium to ensure the implementation and application of the above methods.
[0006] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a resource adjustment method applied to a cloud platform, wherein a server cluster is deployed on the cloud platform, the server cluster includes multiple host machines, and each host machine includes at least one virtual machine, the method comprising: Obtain the host machine monitoring metrics; The load status of the host machine is determined based on the host machine monitoring indicators; the load status includes a non-overload state and an overload state. When the load state is not overloaded, determine the target over-provision ratio of the host machine, and adjust the allocated resources of the host machine according to the target over-provision ratio; When the load status is overloaded, virtual machine migration is performed.
[0007] Optionally, the host monitoring metrics include host resource utilization, and determining the host load status based on the host monitoring metrics includes: The host resource utilization rate of each host machine is compared with a preset resource utilization threshold. If the host machine resource utilization rate is greater than the resource utilization rate threshold, the host machine's load state is determined to be overloaded. If the host machine's resource utilization rate is less than or equal to the resource utilization rate threshold, the host machine's load state is determined to be non-overloaded.
[0008] Optionally, the host monitoring metrics include host resource utilization and virtual machine resource specifications. The step of determining the target over-provisioning ratio of the host machine and adjusting the allocated resources of the host machine according to the target over-provisioning ratio when the load state is not overloaded includes: Obtain the physical resource specifications of the host machine corresponding to the host machine; The first over-allocation ratio is determined based on the host machine's physical resource specifications and the host machine's resource utilization rate; The second over-allocation ratio is determined based on the host machine physical resource specifications and the virtual machine resource specifications; The target over-proportion is determined based on the first over-proportion and the second over-proportion.
[0009] Optionally, determining the first over-allocation ratio based on the host machine's physical resource specifications and the host machine's resource utilization rate includes: The actual resources occupied by the host machine are determined based on the host machine's physical resource specifications and the host machine's resource utilization rate. The total amount of resources that can be over-divided by the host machine is determined based on the actual resources occupied and the preset expected resource utilization rate. The first allocable total resources of the host machine are determined based on the total amount of resources that can be over-allocated and the preset common over-allocation ratio; The first over-allocation ratio is determined based on the first total amount of allocable resources.
[0010] Optionally, determining the second over-allocation ratio based on the host machine's physical resource specifications and the virtual machine's resource specifications includes: The second total allocatable resources of the host machine are determined based on the host machine physical resource specifications and the virtual machine resource specifications. The second over-allocation ratio is determined based on the second total amount of allocable resources.
[0011] Optionally, determining the target over-proportion based on the first over-proportion and the second over-proportion includes: The minimum value among the first overmix ratio, the second overmix ratio, and the preset third overmix ratio is determined as the target overmix ratio.
[0012] Optionally, when the load state is not overloaded, determining the target over-provision ratio of the host machine and adjusting the allocated resources of the host machine according to the target over-provision ratio includes: Determine the current over-allocation ratio corresponding to the host machine; The comparison results are obtained based on the target over-proportion and the current over-proportion. The current over-proportioning ratio is updated based on the comparison results; Adjust the amount of resources allocated to the host machine based on the updated current over-provision ratio.
[0013] Optionally, updating the current over-proportioning ratio based on the comparison result includes: If the comparison result shows that the target over-proportion is less than the current over-proportion, then reduce the current over-proportion. If the comparison result shows that the target over-ratio is greater than the current over-ratio, the current over-ratio is increased.
[0014] Optionally, reducing the current over-proportion when the comparison result shows that the target over-proportion is less than the current over-proportion includes: The target reduction over-allocation ratio is determined based on the target over-allocation ratio, the current over-allocation ratio, and the preset maximum allocation rate; The current over-proportion ratio is updated based on the stated target, reducing the over-proportion ratio accordingly.
[0015] Optionally, increasing the current over-proportion when the comparison result shows that the target over-proportion is greater than the current over-proportion includes: Determine whether the preset over-proportioning increase time is met at the current moment; If the preset over-allocation ratio increase time is met at the current moment, the target increase over-allocation ratio is determined from the target over-allocation ratio within the preset increase update cycle; The current over-proportion ratio is updated by increasing the over-proportion ratio according to the stated objective.
[0016] Optionally, migrating virtual machines when the load state is overloaded includes: The host machine's resource pressure to be unloaded and the resource usage of each virtual machine are determined based on the host machine monitoring metrics. The virtual machines to be migrated are determined based on the host machine's resource pressure to be unloaded and the resource usage corresponding to the virtual machines. Migrate the virtual machine to be migrated.
[0017] Optionally, migrating the virtual machine to be migrated includes: Determine the target host machine from the server cluster; The virtual machine to be migrated is migrated to the target host machine.
[0018] Secondly, embodiments of this application provide a resource adjustment apparatus applied to a cloud platform, wherein a server cluster is deployed on the cloud platform, the server cluster includes multiple host machines, and each host machine includes at least one virtual machine; the apparatus includes: The acquisition module is used to acquire the host machine monitoring metrics of the host machine; The load status determination module is used to determine the load status of the host machine based on the host machine monitoring indicators; the load status includes a non-overload status and an overload status. An adjustment module is used to determine the target over-provision ratio of the host machine when the load state is not overloaded, and adjust the allocated resources of the host machine according to the target over-provision ratio. The migration module is used to migrate virtual machines when the load state is overloaded.
[0019] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0020] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0021] Compared with the prior art, the embodiments of this application have the following advantages: In this embodiment, the resource adjustment method is applied to a cloud platform, which deploys a server cluster. The server cluster includes multiple host machines, and each host machine contains at least one virtual machine. This method acquires host machine monitoring metrics and determines the host machine's load status based on these metrics. The host machine's load status can include a non-overloaded state and an overloaded state. When the load status is non-overloaded, a target over-provisioning ratio for the host machine is determined, and the allocated resources for the host machine are adjusted according to the target over-provisioning ratio. When the load status is overloaded, virtual machine migration is performed. By acquiring the host machine monitoring metrics, the load status of each host machine can be accurately grasped, and different resource adjustment methods can be adopted according to different load statuses. When the host machine is not overloaded, the target over-provisioning ratio for the host machine is automatically determined, and the allocated resources for the host machine are adjusted according to the target over-provisioning ratio. This fully utilizes idle resources on the host machine, avoids host machine performance degradation caused by resource contention between tasks, and allows for timely migration of virtual machines on the host machine when the host machine is overloaded, unloading the load pressure on the host machine and ensuring host machine performance. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating the steps of an embodiment of a resource adjustment method according to this application; Figure 2 This is an adaptive CPU dynamic over-allocation architecture diagram of an embodiment of the resource adjustment method of this application; Figure 3 This is a flowchart illustrating an embodiment of the resource adjustment method of this application: a data center CPU dynamic over-allocation method. Figure 4 This is a structural block diagram of an embodiment of a resource adjustment device according to this application; Figure 5 This is a structural block diagram of an embodiment of a resource adjustment device according to this application. Detailed Implementation
[0024] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0026] The resource adjustments provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings, through specific examples and application scenarios.
[0027] To improve resource utilization, data centers often over-allocate resources, meaning the total resources allocated to tasks on a machine exceed the machine's physical capacity. Over-allocation refers to the proportion of resources allocated to virtual machines or systems that exceed the actual resources available to the physical host. Too low an over-allocation ratio leads to resource waste, while too high an over-allocation ratio results in degraded task performance. In live network resource pools, the CPU over-allocation ratio of host machines is usually determined manually. To avoid resource contention due to CPU over-allocation on host machines, technicians often set conservative CPU over-allocation ratios, resulting in a smaller scale of CPU resources that host machines can provide, leading to a shortage of CPU resources available for allocation in the live network environment. Simultaneously, customers typically apply for cloud server specifications based on the peak resource requirements of their tasks, resulting in low average CPU utilization on cloud servers. This leads to low CPU utilization on host machines, creating a contradiction between low CPU utilization and high CPU allocation, resulting in insufficient utilization of CPU computing resources on host machines.
[0028] Furthermore, a higher CPU overcapacity ratio leads to more tasks being distributed across the same host machine, causing a surge in client application load. This makes it easier for applications to compete for the limited CPU resources on the host machine, resulting in host machine overload. In the event of a sudden spike in CPU utilization, the host machine may not be able to respond in time, leading to continuous resource contention and performance degradation within the host machine.
[0029] In view of this, this application proposes a resource adjustment method that can perform adaptive over-provisioning adjustment within a single machine according to the load status of the host machine, providing a larger scale of salable CPU resources in the form of CPU adaptive over-provisioning to improve CPU utilization, increase the economic benefits of the data center, and also perform virtual machine migration between multiple machines to migrate the CPU load on the overloaded host machine to other nodes in the cluster, ensuring the business performance of the host machine.
[0030] In some embodiments of this application, a resource adjustment method is provided. This method is applied to a cloud platform, on which a server cluster is deployed. The server cluster includes multiple host machines, and each host machine includes at least one virtual machine. (Refer to...) Figure 1 This is a flowchart illustrating the steps of an embodiment of a resource adjustment method according to this application, including the following steps: Step 101: Obtain the host machine monitoring metrics of the host machine; In this context, "host machine" refers to the physical computer that directly runs virtual machines, containers, and other virtual instances in a virtualization or cloud computing environment; it is also known as a host server. Host machine monitoring metrics can include at least various indicators such as host machine resource utilization, host machine resource allocation rate, current over-provisioning ratio, virtual machine resource utilization, virtual machine resource specifications, and virtual machine resource usage, obtained by monitoring the host machine's operational data.
[0031] Step 102: Determine the load status of the host machine based on the host machine monitoring indicators; the load status includes non-overload status and overload status; The host machine's load status reflects the load pressure on the corresponding host machine. The load status can include non-overload status and overload status. The non-overload status can also include moderate status and underload status. The overload status indicates that the host machine is always in a high load state.
[0032] Step 103: When the load state is not overloaded, determine the target over-provision ratio of the host machine, and adjust the allocated resources of the host machine according to the target over-provision ratio; The target over-provisioning ratio can serve as a target for resource adjustment, guiding the adjustment of the amount of resources allocated to the host machine. The amount of resources allocated to the host machine refers to the amount of virtual resources allocated to the host machine.
[0033] Step 104: If the load status is overloaded, perform virtual machine migration.
[0034] In this embodiment, host machine monitoring metrics can be obtained, and the host machine's load status can be determined based on these metrics. The host machine's load status can include a non-overloaded state and an overloaded state. When the host machine's load status is non-overloaded, the target over-provisioning ratio of the host machine can be automatically determined, and the allocated resources of the host machine can be adjusted accordingly. When the host machine's load status is overloaded, virtual machine migration can be performed. Through the above implementation process, the load status of each host machine can be accurately grasped based on the host machine monitoring metrics, and different resource adjustment methods can be adopted according to different load statuses. When the host machine is not overloaded, the target over-provisioning ratio of the host machine is automatically determined, and the allocated resources of the host machine are adjusted accordingly. This can fully utilize the idle resources on the host machine, avoid host machine performance degradation caused by task contention for resources, and when the host machine is overloaded, virtual machine migration operations can be performed on the host machine in a timely manner to unload the load pressure on the host machine and ensure the business performance of the host machine.
[0035] In some embodiments of this application, step 101, obtaining the host machine monitoring metrics, can be achieved by periodically collecting host machine performance metrics on each host machine. For example, a scheduled monitoring task can be set up on each host machine to periodically read the underlying / proc (process information pseudo-file system) / stat (status information) file and the virtualization virsh command (virtualization virsh command is a KVM virtualization management tool used to manage the lifecycle, configuration, and status of virtual machines) according to a preset collection time to collect the performance metrics of each host machine as host machine monitoring metrics. The collected host machine monitoring metrics can be pushed to the Prometheus (monitoring system) database of the server cluster via a URL for storage.
[0036] In some embodiments of this application, the host machine monitoring metrics include host machine resource utilization, and determining the host machine load status based on the host machine monitoring metrics includes: The host resource utilization rate of each host machine is compared with a preset resource utilization threshold. If the host machine resource utilization rate is greater than the resource utilization rate threshold, the host machine's load state is determined to be overloaded. If the host machine's resource utilization rate is less than or equal to the resource utilization rate threshold, the host machine's load state is determined to be non-overloaded.
[0037] Host resource utilization reflects the CPU resource pressure on the host machine and measures the degree of competition for CPU resources. The host resource utilization rate for each host machine can be compared with a preset resource utilization threshold. For example, the resource utilization threshold can be set to 80%, or it can be set according to actual needs; this application does not impose specific restrictions. If the host resource utilization rate is greater than the threshold, the host machine's load state can be determined as overloaded, and at this time, various tasks within the host machine may experience resource contention. If the host resource utilization rate is less than or equal to the threshold, the host machine's load state can be determined as non-overloaded, and at this time, the host machine's resources are sufficient to meet the current task execution. Through the above implementation process, the host resource utilization rate for each host machine can be determined from the host machine monitoring indicators, and then the load state of each host machine can be determined based on the host resource utilization rate, providing a reference for subsequent resource adjustment.
[0038] In some embodiments of this application, the host monitoring metrics include host resource utilization and virtual machine resource specifications. The step of determining the target over-provisioning ratio of the host machine and adjusting the allocated resources of the host machine according to the target over-provisioning ratio when the load state is not overloaded includes: Obtain the physical resource specifications of the host machine corresponding to the host machine; The first over-allocation ratio is determined based on the host machine's physical resource specifications and the host machine's resource utilization rate; The second over-allocation ratio is determined based on the host machine physical resource specifications and the virtual machine resource specifications; The target over-proportion is determined based on the first over-proportion and the second over-proportion.
[0039] The virtual machine resource specification represents the amount of resources allocated to virtual machines on the host machine. The host machine physical resource specification represents the actual physical CPU capacity of the host machine. The host machine's physical resource specification can be obtained, and then a first over-allocation ratio can be determined based on the host machine's physical resource specification and host machine resource utilization. A second over-allocation ratio can also be determined based on the host machine's physical resource specification and virtual machine resource specification. The first and second over-allocation ratios are then used to determine the target over-allocation ratio for guiding resource adjustments. The resource over-allocation ratio is inversely proportional to the host machine's resource utilization, meaning it is closely related to the actual amount of resources used on the host machine. Furthermore, periodic fluctuations in the historical virtual machine resource usage on the host machine may also cause fluctuations in the host machine's resource pressure. Through the above implementation process, based on the host machine's physical resource specification, and then based on the host machine's resource utilization and virtual machine resource specifications determined from host machine monitoring indicators, a first over-allocation ratio determined from the host machine's perspective and a second over-allocation ratio determined from the virtual machine's perspective can be obtained. Furthermore, the target over-allocation ratio can be determined from multiple perspectives based on the first and second over-allocation ratios, making the final target over-allocation ratio more reasonable.
[0040] In some embodiments of this application, determining the first over-allocation ratio based on the host machine's physical resource specifications and the host machine's resource utilization rate includes: The actual resources occupied by the host machine are determined based on the host machine's physical resource specifications and the host machine's resource utilization rate. The total amount of resources that can be over-divided by the host machine is determined based on the actual resources occupied and the preset expected resource utilization rate. The first allocable total resources of the host machine are determined based on the total amount of resources that can be over-allocated and the preset common over-allocation ratio; The first over-allocation ratio is determined based on the first total amount of allocable resources.
[0041] The actual resources occupied by the host can be determined based on the host's physical resource specifications and resource utilization rate. The actual resources occupied by the host can be expressed by the following formula: host_cpu_util=host_cpu×cpu_util_ratio Among them, host_cpu_util represents the actual resources occupied by the host machine, host_cpu represents the physical resource specifications of the host machine, and cpu_util_ratio represents the resource utilization rate of the host machine.
[0042] Besides the actual resources used on the host machine, the remaining CPU resources can be over-provisioned to allocate to more virtual machines. However, considering that over-provisioning all remaining resources on the host machine to virtual machines could lead to severe CPU resource contention among multiple virtual machines during peak business hours, this application embodiment pre-sets an expected resource utilization rate, which represents the ideal value of host machine resource utilization. For example, by analyzing the existing network host machine operating environment, it can be determined that 50% is an ideal value for host machine resource utilization. At a host machine resource utilization rate of 50%, the underlying CPU resources can be fully utilized, avoiding resource waste, while sufficient remaining CPU resources can buffer sudden CPU resource pressure. Therefore, the expected resource utilization rate can be set to 50%. Of course, other expected resource utilization rates can be set according to different business needs and operating environments; this application does not impose specific limitations on this.
[0043] The total amount of super-divisible resources on the host machine can be determined based on the actual resources used and the preset expected resource utilization rate. With an expected resource utilization rate of 50%, the total amount of super-divisible resources on the host machine can be expressed by the following formula: host_cpu_free=host_cpu×50%-host_cpu_util Among them, host_cpu_free represents the total amount of super-divisible resources on the host machine, host_cpu represents the physical resource specifications of the host machine, and host_cpu_util represents the actual resources occupied by the host machine.
[0044] In live network environments, cloud providers typically over-sell CPU resources, allowing virtual machines to share underlying CPU resources to reduce operating costs. A common over-provisioning ratio can be a default ratio frequently used in past applications, often set to 3 based on experience. However, this application does not impose specific restrictions on the common over-provisioning ratio, as it is usually conservatively set based on experience. Under this common over-provisioning ratio, it is unlikely that the host machine's CPU utilization will exceed the limit. The first allocatable resource total of the host machine can be determined based on the total amount of over-provisionable resources and the preset common over-provisioning ratio. The first allocatable resource total of the host machine can be expressed by the following formula: host_cpu_alloc_free=host_cpu_free×df_cpu_ratio Among them, host_cpu_alloc_free represents the first allocable total amount of resources on the host machine, which can represent the amount of resources that the host machine can allocate to virtual machines. host_cpu_free represents the total amount of resources that the host machine can over-allocate, and df_cpu_ratio represents the common over-allocation ratio.
[0045] Therefore, the first over-allocation ratio can be determined based on the first total amount of allocable resources, and the first over-allocation ratio can be expressed by the following formula:
[0046] Where opt_cpu_ratio_1 represents the first over-provision ratio, df_cpu_ratio represents the common over-provision ratio, host_cpu_alloc_free represents the first total allocable resources of the host machine, and host_cpu represents the physical resource specifications of the host machine.
[0047] Placing too many virtual machines on a host machine can lead to excessive resource utilization on the host, resulting in resource contention among the virtual machines. The above process determines the actual resources occupied by the host machine and, combined with the expected resource allocation, calculates the total amount of resources that can be over-allocated on the host. This ensures that after resource over-provisioning adjustments, the resource utilization on the host machine can be maintained around the expected value, thus optimizing the subsequent over-provisioning ratio. Then, by combining commonly used over-provisioning ratios, the first total allocable resource corresponding to the over-provisionable resources can be determined, leading to the first over-provisioning ratio based on the actual resource usage of the host machine.
[0048] In some embodiments of this application, determining the second over-allocation ratio based on the host machine physical resource specifications and the virtual machine resource specifications includes: The second total allocatable resources of the host machine are determined based on the host machine physical resource specifications and the virtual machine resource specifications. The second over-allocation ratio is determined based on the second total amount of allocable resources.
[0049] The total amount of second-allocable resources on the host machine can be determined based on the host machine's physical resource specifications and the virtual machine's resource specifications. The total amount of second-allocable resources on the host machine can be expressed by the following formula:
[0050] Where `host_cpu_util_free` represents the total amount of secondary allocatable resources on the host machine; `host_cpu` represents the physical resource specifications of the host machine; 50% is the expected resource utilization rate; and `vm_cpu`... i This represents the virtual machine specification of the i-th virtual machine on the host machine, where n represents the total number of virtual machines on the host machine, and vm_cpu iBoth and n can be obtained from host machine monitoring metrics; vm_cpu_util_ratio_max i This represents the preset maximum utilization rate of virtual machines. The maximum utilization rate of virtual machines can be set based on historical experience, and this application does not impose specific restrictions on it. Based on the expected resource utilization rate, the resources on the host machine that meet the expected usage can be determined. Then, by subtracting the cumulative value of the maximum resource usage of the existing virtual machines on the host machine calculated based on the preset maximum utilization rate of virtual machines, the remaining second allocatable total resources of the host machine can be obtained.
[0051] Then, the second over-allocation ratio can be determined based on the second total amount of allocable resources. The second over-allocation ratio can be expressed by the following formula:
[0052] Where opt_cpu_ratio_2 represents the second overspec ratio, df_cpu_ratio represents the common overspec ratio, host_cpu_util_free represents the second total allocable resources of the host machine, and host_cpu represents the physical resource specifications of the host machine.
[0053] Through the above implementation process, the total amount of the second allocable resources remaining on the host machine can be determined based on the maximum utilization rate of virtual machines preset according to historical experience. Then, the total amount of the second allocable resources can be determined by combining the commonly used over-allocation ratio, and thus the second over-allocation ratio determined from the perspective of the maximum utilization rate of virtual machines can be obtained.
[0054] In some embodiments of this application, determining the target over-proportion based on the first over-proportion and the second over-proportion includes: The minimum value among the first overmix ratio, the second overmix ratio, and the preset third overmix ratio is determined as the target overmix ratio.
[0055] The preset third over-allocation ratio, opt_cpu_ratio_3, can be the maximum over-allocation ratio determined based on expert experience, i.e., the upper limit of the host machine resource over-allocation ratio. For example, the default common over-allocation ratio might be 3; to further over-allocate CPU resources, opt_cpu_ratio_3 can be set to 4. Then, the minimum value among the first, second, and preset third over-allocation ratios can be determined as the target over-allocation ratio. The target over-allocation ratio opt_cpu_ratio can be expressed by the following formula: opt_cpu_ratio=min(opt_cpu_ratio_1, opt_cpu_ratio_2, opt_cpu_ratio_3) After determining the target over-allocation ratio, it can be stored in a database as a reference value for subsequent adjustments to the CPU over-allocation ratio. Through the above implementation process, based on the allocated resources already used on the host machine, the maximum utilization resources of the virtual machines, and historical experience, a first, second, and third over-allocation ratio can be obtained from different perspectives. Then, by combining these over-allocation ratios, the most conservative one, i.e., the minimum value, is selected as the target over-allocation ratio. This allows for dynamic adjustment of the target over-allocation ratio based on the actual situation of the host machine or the virtual machines on it.
[0056] In some embodiments of this application, determining the target over-provision ratio of the host machine and adjusting the allocated resources of the host machine according to the target over-provision ratio when the load state is not overloaded includes: Determine the current over-allocation ratio corresponding to the host machine; The comparison results are obtained based on the target over-proportion and the current over-proportion. The current over-proportioning ratio is updated based on the comparison results; Adjust the amount of resources allocated to the host machine based on the updated current over-provision ratio.
[0057] The current over-allocation ratio of the host machine can be determined from the host machine monitoring metrics. Then, a comparison result is obtained based on the target over-allocation ratio and the current over-allocation ratio. The current over-allocation ratio is updated based on the comparison result, and the allocated resources of the host machine are adjusted according to the updated current over-allocation ratio. Through the above implementation process, the current over-allocation ratio can be updated based on the target over-allocation ratio, thereby adjusting the allocated resources of the host machine.
[0058] In some embodiments of this application, updating the current over-proportioning ratio based on the comparison result includes: If the comparison result shows that the target over-proportion is less than the current over-proportion, then reduce the current over-proportion. If the comparison result shows that the target over-ratio is greater than the current over-ratio, the current over-ratio is increased.
[0059] The target over-provisioning ratio can be compared with the current over-provisioning ratio. If the target over-provisioning ratio is less than the current over-provisioning ratio, it indicates that the current over-provisioning ratio is too large. This may cause the host machine's physical CPU to handle a large number of virtual machine requests simultaneously, resulting in excessive host machine resource utilization and performance degradation. Too many virtual machines sharing limited physical CPU resources can also lead to resource contention, reducing application performance. In this case, the current over-provisioning ratio can be reduced promptly based on the target over-provisioning ratio. Conversely, if the target over-provisioning ratio is greater than the current over-provisioning ratio, it indicates that the current over-provisioning ratio is too small. This may limit the number of virtual machine requests that can be processed, resulting in low host machine resource utilization, wasted resources, and ultimately affecting application performance. In this case, the current over-provisioning ratio can be increased promptly based on the target over-provisioning ratio. Through the above implementation process, the current over-provision ratio can be adaptively adjusted according to the target over-provision ratio. Increasing the over-provision ratio can improve the resource utilization on non-overloaded host machines, increase the available CPU resources, and allow more tasks to run on the same host machine. Alternatively, the over-provision ratio can be reduced to decrease the resource utilization on overloaded host machines, reduce the available CPU resources on the corresponding host machines, and avoid resource contention between tasks, so as to ensure that the host machine's servers can maintain a better resource utilization rate and ensure the performance of the host application.
[0060] In some embodiments of this application, obtaining a comparison result based on the target overspending ratio and the current overspending ratio may include: comparing the target overspending ratio and the current overspending ratio using a bucketing strategy. The number of buckets corresponding to the target overspending ratio and the current overspending ratio can be determined based on a preset bucket size, and the comparison result is obtained by comparing the number of buckets corresponding to the target overspending ratio and the current overspending ratio. For example, the preset bucket size (bucket_size) can be set to 0.2 based on experience, the number of buckets corresponding to the target overspending ratio (opt_cpu_ratio) is (opt_cpu_ratio_bucket = opt_cpu_ratio / / bucket_size), and the number of buckets corresponding to the current overspending ratio (cur_cpu_ratio) is (cur_cpu_ratio_bucket = cur_cpu_ratio / / bucket_size), where / / is an integer division operator, and the resulting number of buckets is always an integer. Because CPU resources and memory resources differ, CPU resources can tolerate a certain degree of resource contention, but memory contention can trigger Out Of Memory (OOM). The above implementation process reduces the sensitivity of the adaptive resource over-provisioning mechanism, avoids frequent modifications to the over-provisioning ratio due to normal fluctuations in resource utilization, reduces the number of adjustments to the current over-provisioning ratio of host resources, and lowers the risk of OOM.
[0061] For example, suppose the target over-allocation ratio is 3.3 and the current over-allocation ratio is 3.4. Although the target over-allocation ratio is less than the current over-allocation ratio, the number of buckets corresponding to the target over-allocation ratio is equal to the number of buckets corresponding to the current over-allocation ratio. In this case, the current over-allocation ratio does not need to be modified.
[0062] In some embodiments of this application, reducing the current over-proportion when the comparison result shows that the target over-proportion is less than the current over-proportion includes: The target reduction over-allocation ratio is determined based on the target over-allocation ratio, the current over-allocation ratio, and the preset maximum allocation rate; The current over-proportion ratio is updated based on the stated target, reducing the over-proportion ratio accordingly.
[0063] If the comparison result shows that the target over-allocation ratio is less than the current over-allocation ratio, the target reduction over-allocation ratio can be determined based on the target over-allocation ratio, the current over-allocation ratio, and the preset maximum allocation rate. The maximum allocation rate can represent the maximum allocation rate of resources on the host machine. For example, the maximum allocation rate can be set to 95%. Of course, the maximum allocation rate can also be set to other values depending on the specific circumstances, and this application does not impose specific restrictions on this.
[0064]
[0065] Among them, opt_cpu_ratio_down represents the target reduction overspec ratio, opt_cpu_ratio represents the target overspec ratio obtained based on the first, second, and third overspec ratios, cur_cpu_ratio represents the current overspec ratio, host_cpu_used represents the amount of resources currently allocated on the host machine, and host_cpu represents the physical resource specifications of the host machine.
[0066] The amount of resources allocated to virtual machines on the host machine can be limited by setting a maximum allocation rate. With a maximum allocation rate of 95%, `host_cpu_used / (host_cpu × overspec ratio)` must be less than or equal to 95%. In this case, the corresponding overspec ratio will be greater than or equal to `host_cpu_used / (host_cpu × 95%)`. First, determine the larger of the target overspec ratio obtained from the first, second, and third overspec ratios and `host_cpu_used / (host_cpu × 95%)`. Then, compare this larger overspec ratio with the current overspec ratio and select the smaller value as the target reduction overspec ratio. Finally, update the current overspec ratio based on the target reduction overspec ratio and store `cur_cpu_ratio = opt_cpu_ratio_down` in the database. Through the above implementation process, by setting the maximum allocation rate, when determining the target reduction of the over-allocation ratio and updating the current over-allocation ratio according to the target reduction of the over-allocation ratio, the resource allocation rate on the host machine is guaranteed to remain at the preset maximum allocation rate. This allows the resource allocation rate on the host machine to be controlled within a preset range, avoiding the performance degradation of the host machine caused by excessive resource allocation.
[0067] In some embodiments of this application, increasing the current over-ratio when the comparison result shows that the target over-ratio is greater than the current over-ratio includes: Determine whether the preset over-proportioning increase time is met at the current moment; If the preset over-allocation ratio increase time is met at the current moment, the target increase over-allocation ratio is determined from the target over-allocation ratio within the preset increase update cycle; The current over-proportion ratio is updated by increasing the over-proportion ratio according to the stated objective.
[0068] The over-proportion increase time can be a pre-set fixed time or time period that allows over-proportion increase. For example, 24 hours can be used as an increase update cycle, and a fixed time or a fixed time period within 24 hours can be used as the update time for allowing over-proportion increase. The specific cycle and time (segment) can be set according to actual needs, and this application does not impose specific restrictions on them.
[0069] If the comparison result shows that the target over-allocation ratio is greater than the current over-allocation ratio, we can first determine whether the preset over-allocation ratio increase time is met at the current moment. If the preset over-allocation ratio increase time is met at the current moment, the target increased over-allocation ratio is determined from the target over-allocation ratios within the preset increase update period, and the current over-allocation ratio is updated based on the target increased over-allocation ratio. Each obtained target over-allocation ratio is stored in the database. If the over-allocation ratio increase time is met, we can retrieve all target over-allocation ratios stored in the database within the preset increase update period, and select the minimum value among all target over-allocation ratios as the target increased over-allocation ratio.
[0070] To avoid host machine overload, it's necessary to ensure that the current over-provisioning ratio can be updated at any time. However, frequent triggering of host machine over-provisioning ratio adjustments can severely impact the online environment's resource view. The implementation process described in this application, by setting the over-provisioning ratio increase time, effectively reduces the number of times the current over-provisioning ratio is adjusted, ensuring that the increase can only occur within a fixed time period within the cycle. Furthermore, selecting the smallest target over-provisioning ratio among the target over-provisioning ratios within the update cycle as the target increase over-provisioning ratio allows for a cautious increase in the over-provisioning ratio, preventing excessive increases that could lead to a sudden rise in host machine resource utilization and consequently affect host machine application performance.
[0071] In some embodiments of this application, the virtual machine migration when the load state is overloaded includes: The host machine's resource pressure to be unloaded and the resource usage of each virtual machine are determined based on the host machine monitoring metrics. The virtual machines to be migrated are determined based on the host machine's resource pressure to be unloaded and the resource usage corresponding to the virtual machines. Migrate the virtual machine to be migrated.
[0072] When the load is overloaded, the host machine's resource pressure to be unloaded and the resource usage of each virtual machine are determined based on host machine monitoring metrics. The host machine's resource pressure to be unloaded reflects the number of CPU resources corresponding to the virtual machines that need to be unloaded. Host machine monitoring metrics can include the host machine's physical resource specifications and resource utilization. The host machine's resource pressure to be unloaded can be expressed by the following formula: host_cpu_pressure=host_cpu×(cpu_util_ratio-50%) Here, `host_cpu_pressure` represents the host machine's unloaded pressure, `host_cpu` represents the host machine's physical resource specifications, `cpu_util_ratio` represents the host machine's resource utilization, and 50% is the preset expected resource utilization. Unloading the host machine's unloaded pressure can bring the host machine's resource utilization back to around the preset expected resource utilization.
[0073] After determining the host machine's resource pressure to be unloaded, the virtual machines on the host machine to be migrated can be determined based on the host machine's resource pressure and the corresponding resource usage of the virtual machines. For example, the virtual machines on the overloaded host machine can be sorted according to their respective CPU resource usage, where the virtual machine's resource usage is calculated as vm_cpu_use = vm_cpu × vm_cpu_util_ratio, where vm_cpu represents the virtual machine's resource specification and vm_cpu_util_ratio represents the virtual machine's resource utilization rate. The virtual machines can be sorted from smallest to largest based on their resource usage, and the resource usage of the virtual machines on the host machine can be accumulated in ascending order until the host machine's unloading pressure is met. Then, the virtual machines corresponding to the accumulated resource usage are identified as the virtual machines to be migrated, and these virtual machines are migrated.
[0074] Adjusting the current overprovision ratio within a single machine can increase the saleable CPU resources on the host machine and reduce the current overprovision ratio when the host machine's load pressure increases to avoid adding more virtual machines to the same host machine. However, customer business loads are random, and sudden increases in load pressure may not be avoidable by adjusting the current overprovision ratio. Through the above implementation process, virtual machines to be migrated can be quickly identified based on the unloaded pressure on the host machine, and virtual machine migration can be performed to offload the CPU resource pressure on the overloaded host machine to other host machines, so that the resource utilization of the overloaded host machine can return to an ideal state.
[0075] For example, after identifying the virtual machines to be migrated, a corresponding virtual machine migration list, vm_migrate_list, can also be generated. i The virtual machine migration list (vm_migrate_list) within the server cluster is a collection of virtual machine migration lists from each overloaded host machine, and can be represented as: vm_migrate_list=[vm j if vm j ∈vm_migrate_list i i∈(1,m),j∈(1,n) Among them, vm_migrate_list iThis represents the migration list of the i-th virtual machine in the cluster, where m is the number of virtual machine migration lists in the cluster, and vm j This represents the j-th virtual machine to be migrated in the virtual machine migration list, and n is the number of virtual machines to be migrated in the i-th virtual machine migration list.
[0076] In some embodiments of this application, migrating the virtual machine to be migrated includes: Determine the target host machine from the server cluster; The virtual machine to be migrated is migrated to the target host machine.
[0077] Based on the host resource utilization rates of each host in the host monitoring metrics, the load status of a host can be determined as underloaded. For example, a host whose resource utilization rate is lower than a preset underload threshold can be identified as underloaded. Then, the unload pressure on underloaded hosts can be calculated. The unload pressure obtained in an underloaded state is a negative value. In this state, the lower the unload pressure, the lower the resource pressure on the host, and the more virtual machines it can accept. Hosts can be sorted from lowest to highest unload pressure to obtain a list of acceptable hosts. Servers in this list are then identified as target hosts.
[0078] The virtual machines in the migration list are arranged from lowest to highest resource usage. Based on the reverse order of the migration list and the ascending order of the accepting host list, virtual machines with higher resource usage are prioritized for migration to target hosts with lower resource pressure. Furthermore, the migration must satisfy the condition `host_cpu_pressure + vm_cpu_use < 0`, ensuring that the target host does not become an overloaded host after the virtual machine is migrated. Through this process, the resource pressure of each host in the server cluster is managed, the target host is quickly located, and high-load virtual machines are prioritized for migration. This quickly adjusts the load on overloaded hosts, ensuring application performance on the host machines.
[0079] For example, due to limited CPU resources within the server cluster, virtual machines in the virtual machine migration list may not be able to be fully migrated to the target server, leaving some host machines still in an overloaded state. In this case, an alarm can be triggered, generating corresponding alarm information and sending it to technical personnel to notify them to intervene manually.
[0080] Reference Figure 2 This is an adaptive CPU dynamic over-allocation architecture diagram of an embodiment of a resource adjustment method of this application.
[0081] The cloud platform can deploy server clusters and a cluster scheduling center. The server cluster can include multiple servers such as server 1, server 2, and server 3 as host machines. The cluster scheduling center can receive host machine monitoring indicators reported by each server (host machine), determine the over-provisioning ratio based on the received host machine monitoring indicators, and adjust the over-provisioning ratio based on subsequent host machine monitoring indicator feedback. The cluster scheduling center can also automatically trigger hotspot elimination when the host machine is in an overloaded state, and coordinate the migration of virtual machines among multiple machines in the cluster to relieve resource pressure.
[0082] Each server may include multiple virtual machines (VMs), a shared underlying CPU list across all VMs, a data plane agent, and an adaptive CPU over-provisioning module. The data plane agent, also known as the data plane monitoring module, collects various monitoring metrics of the VMs and CPU resources within the server and reports them to the cluster scheduling center. It also provides feedback on the server's internal load and monitoring metrics to the adaptive CPU over-provisioning module. The adaptive CPU over-provisioning module dynamically determines the over-provisioning ratio based on the server's CPU resource utilization and allocation rate, and adjusts the server's over-provisioning ratio based on subsequent CPU resource utilization feedback.
[0083] The aforementioned adaptive CPU dynamic over-provisioning architecture, based on the data plane monitoring module, the adaptive CPU over-provisioning ratio adjustment module within a single machine, and hotspot elimination in the cluster scheduling center, monitors the load status of each server and dynamically adjusts the server CPU over-provisioning ratio as needed to provide more available CPU resources and increase server CPU utilization. Simultaneously, the hotspot elimination strategy prevents virtual machines from competing for the limited CPU resources on the server.
[0084] Reference Figure 3 This is a flowchart illustrating the implementation of a data center CPU dynamic over-allocation method according to an embodiment of the resource adjustment method of this application.
[0085] The data plane monitoring system can monitor the CPU utilization (i.e., host resource utilization) and CPU allocation rate of each server (host) in real time, and use them as data input for the CPU dynamic over-provisioning adjustment strategy. Server load is divided based on the CPU utilization of each server to determine the host machine with overloaded server resources and the host machine with underloaded / moderate (i.e., not overloaded) server resources. For host machines with underutilized or moderately overloaded server resources, adaptive CPU overproportioning can be adjusted within a single machine. The first overproportioning ratio can be determined based on server CPU usage, the second based on historical virtual machine usage, and the third based on expert experience. Then, the theoretical CPU overproportioning ratio (target overproportioning ratio) is determined based on these ratios. Next, CPU overproportioning is modified by bucketing based on the theoretical and current overproportions to determine the comparison between the two ratios. Based on this comparison, the current overproportioning ratio is adjusted, and the adjusted ratio is fed back to the data plane monitoring system for control.
[0086] For host machines with overloaded server resources, hotspot elimination between multiple machines can be triggered; virtual machines to be migrated on each host machine can be identified and a virtual machine migration list can be generated within the cluster; a list of underloaded servers within the cluster can also be identified, and then the pressure can be relieved by migrating virtual machines on overloaded host machines to underloaded servers, and the relevant indicators after the virtual machine migration and adjustment can be fed back to the data plane monitoring system.
[0087] Through the above-described data center CPU dynamic overprovisioning method implementation process, overloaded and non-overloaded hosts can be identified in the server cluster. For non-overloaded hosts, an adaptive CPU overprovisioning ratio adjustment strategy is proposed within a single machine. Guided by the server's already used CPU resources, this strategy alleviates the contradiction between high CPU allocation and low CPU utilization within the server. When CPU utilization is low, the host's CPU overprovisioning ratio is gradually increased to provide more sufficient CPU computing resources, increasing the total amount of marketable resources in the data center. This allows more virtual machines to be placed on the same server, fully utilizing the idle CPU computing resources on the host. Simultaneously, server CPU utilization is used as a feedback indicator. When utilization is high, i.e., resources are scarce, the CPU overprovisioning ratio is promptly reduced to avoid placing more tasks on the server and causing resource contention between tasks due to CPU overprovisioning, thus meeting the customer's SLA (Service Level Agreement). The goal is to achieve a larger scale of salable CPU resources for the host machine through adaptive super-division, thereby improving the CPU resource utilization on the host machine and increasing the economic benefits of the data center. For overloaded hosts, a multi-machine hotspot elimination strategy is proposed. In order to cope with the resource contention and business performance degradation caused by sudden surges in CPU utilization, the hotspot elimination system can coordinate the allocation of CPU resources within the cluster and offload some virtual machines from overloaded servers to underloaded servers through explicit multi-machine hot migration to complete the hotspot elimination within the cluster.
[0088] It should be noted that the resource adjustment method provided in this application embodiment can be executed by a resource adjustment device, or a control module within the resource adjustment device for executing the method of loading resource adjustment. This application embodiment uses the execution of the method of loading resource adjustment by a resource adjustment device as an example to illustrate the resource adjustment method provided in this application embodiment.
[0089] Reference Figure 4 This is a structural block diagram of an embodiment of a resource adjustment device according to this application. The device can be applied to a cloud platform, where a server cluster is deployed. The server cluster includes multiple host machines, and each host machine includes at least one virtual machine. The device may include the following modules: The acquisition module 401 is used to acquire the host machine monitoring indicators of the host machine; The load status determination module 402 is used to determine the load status of the host machine based on the host machine monitoring indicators; the load status includes a non-overload status and an overload status. The adjustment module 403 is used to determine the target over-provision ratio of the host machine when the load state is not overloaded, and adjust the allocated resources of the host machine according to the target over-provision ratio. Migration module 404 is used to migrate virtual machines when the load state is overloaded.
[0090] The host monitoring metrics include host resource utilization. The load status determination module 402 includes: The resource utilization comparison submodule is used to compare the host resource utilization rate of each of the said host machines with a preset resource utilization rate threshold. The load status determination submodule is used to determine that the load status of the host machine is overloaded when the host machine resource utilization rate is greater than the resource utilization rate threshold, and to determine that the load status of the host machine is not overloaded when the host machine resource utilization rate is less than or equal to the resource utilization rate threshold.
[0091] The host monitoring metrics include host resource utilization and virtual machine resource specifications. The adjustment module 403 includes: The host physical resource specification acquisition submodule is used to acquire the host physical resource specifications corresponding to the host. The first over-allocation determination submodule is used to determine the first over-allocation ratio based on the host machine physical resource specifications and the host machine resource utilization rate. The second over-allocation determination submodule is used to determine the second over-allocation ratio based on the host machine physical resource specifications and the virtual machine resource specifications. The target over-proportion determination submodule is used to determine the target over-proportion based on the first over-proportion and the second over-proportion.
[0092] The first over-proportion determination submodule includes: The host machine actual resource occupation determination unit is used to determine the actual resource occupation of the host machine based on the host machine physical resource specifications and the host machine resource utilization rate. The host machine's total super-divisible resource determination unit is used to determine the total super-divisible resource of the host machine based on the actual occupied resources and the preset expected resource utilization rate. The host machine first allocable total resource determination unit is used to determine the first allocable total resource of the host machine based on the total allocable resource and the preset common over-allocation ratio; The first over-allocation determination unit is used to determine the first over-allocation ratio based on the first total amount of allocable resources.
[0093] The second over-proportion determination submodule includes: The host machine second allocable total resource determination unit is used to determine the second allocable total resource of the host machine based on the host machine physical resource specifications and the virtual machine resource specifications; The second over-allocation determination unit is used to determine the second over-allocation ratio based on the second total amount of allocable resources.
[0094] The target over-proportion determination submodule is further used for: The minimum value among the first overmix ratio, the second overmix ratio, and the preset third overmix ratio is determined as the target overmix ratio.
[0095] The adjustment module 403 further includes: The current over-allocation determination submodule is used to determine the current over-allocation corresponding to the host machine; The comparison submodule is used to obtain the comparison result based on the target over-proportion and the current over-proportion; The current over-ratio update submodule is used to update the current over-ratio based on the comparison results; The resource allocation adjustment submodule is used to adjust the allocated resources of the host machine according to the updated current over-allocation ratio.
[0096] The current over-allocation update submodule includes The current over-ratio reduction unit is used to reduce the current over-ratio when the comparison result shows that the target over-ratio is less than the current over-ratio; The current over-ratio increase unit is used to increase the current over-ratio when the comparison result shows that the target over-ratio is greater than the current over-ratio.
[0097] The current over-ratio reduction unit is further used for: The target reduction over-allocation ratio is determined based on the target over-allocation ratio, the current over-allocation ratio, and the preset maximum allocation rate; The current over-proportion ratio is updated based on the stated target, reducing the over-proportion ratio accordingly.
[0098] The current over-proportioning unit is further used for: Determine whether the preset over-proportioning increase time is met at the current moment; If the preset over-allocation ratio increase time is met at the current moment, the target increase over-allocation ratio is determined from the target over-allocation ratio within the preset increase update cycle; The current over-proportion ratio is updated by increasing the over-proportion ratio according to the stated objective.
[0099] The migration module 404 includes: The indicator determination submodule is used to determine the host machine's resource pressure to be uninstalled and the resource usage of each virtual machine based on the host machine monitoring indicators. The virtual machine to be migrated determination submodule is used to determine the virtual machine to be migrated based on the host machine's unloaded resource pressure and the resource usage corresponding to the virtual machine; The migration submodule is used to migrate the virtual machine to be migrated.
[0100] The migration submodule includes: A target host determination unit is used to determine the target host from the server cluster; A migration unit is used to migrate the virtual machine to be migrated to the target host machine.
[0101] The resource adjustment device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0102] The resource adjustment device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0103] The resource adjustment device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented by the resource adjustment device in the method embodiment will not be described again here to avoid repetition.
[0104] The resource adjustment apparatus provided in some embodiments of this application can acquire host machine monitoring metrics and then determine the host machine's load status based on these metrics. The host machine's load status can include a non-overload state and an overload state. When the host machine's load status is non-overloaded, the target over-provisioning ratio of the host machine can be automatically determined, and the allocated resources of the host machine can be adjusted accordingly. When the host machine's load status is overloaded, virtual machine migration can be performed. Through the above implementation process, the load status of each host machine can be accurately grasped based on the host machine monitoring metrics, and different resource adjustment methods can be adopted according to different load statuses. When the host machine is not overloaded, the target over-provisioning ratio of the host machine is automatically determined, and the allocated resources of the host machine are adjusted accordingly. This fully utilizes idle resources on the host machine, avoids host machine performance degradation caused by resource contention between tasks, and allows for timely migration of virtual machines on the host machine when the host machine is overloaded, thus relieving the load pressure on the host machine and ensuring the business performance of the host machine.
[0105] Optional, refer to Figure 5 This is a structural block diagram of a resource adjustment device embodiment of this application. This application embodiment also provides an electronic device, including a processor 501, a memory 502, and a program or instructions stored in the memory 502 and executable on the processor 501. When the program or instructions are executed by the processor 501, they implement the various processes of the above-described resource adjustment method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0106] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0107] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described resource adjustment method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0108] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0109] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0110] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0111] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A resource adjustment method, characterized in that, Applied to a cloud platform, wherein a server cluster is deployed on the cloud platform, the server cluster includes multiple host machines, and each host machine includes at least one virtual machine, the method includes: Obtain the host machine monitoring metrics of the host machine; The load status of the host machine is determined based on the host machine monitoring indicators; the load status includes a non-overload state and an overload state. When the load state is not overloaded, determine the target over-provision ratio of the host machine, and adjust the allocated resources of the host machine according to the target over-provision ratio; When the load status is overloaded, virtual machine migration is performed.
2. The method according to claim 1, characterized in that, The host machine monitoring metrics include host machine resource utilization. Determining the host machine's load status based on the host machine monitoring metrics includes: The resource utilization rate of each host machine is compared with a preset resource utilization threshold. If the host machine resource utilization rate is greater than the resource utilization rate threshold, the host machine's load state is determined to be overloaded. If the host machine's resource utilization rate is less than or equal to the resource utilization rate threshold, the host machine's load state is determined to be non-overloaded.
3. The method according to claim 1, characterized in that, The host monitoring metrics include host resource utilization and virtual machine resource specifications. The step of determining the target over-provisioning ratio of the host machine when the load state is not overloaded, and adjusting the allocated resources of the host machine according to the target over-provisioning ratio, includes: Obtain the physical resource specifications of the host machine corresponding to the host machine; The first over-allocation ratio is determined based on the host machine's physical resource specifications and the host machine's resource utilization rate; The second over-allocation ratio is determined based on the host machine physical resource specifications and the virtual machine resource specifications; The target over-proportion is determined based on the first over-proportion and the second over-proportion.
4. The method according to claim 3, characterized in that, The step of determining the first over-allocation ratio based on the host machine's physical resource specifications and the host machine's resource utilization rate includes: The actual resources occupied by the host machine are determined based on the host machine's physical resource specifications and the host machine's resource utilization rate. The total amount of resources that can be over-divided by the host machine is determined based on the actual resources occupied and the preset expected resource utilization rate. The first allocable total resources of the host machine are determined based on the total amount of resources that can be over-allocated and the preset common over-allocation ratio; The first over-allocation ratio is determined based on the first total amount of allocable resources.
5. The method according to claim 3, characterized in that, The step of determining the second over-allocation ratio based on the host machine's physical resource specifications and the virtual machine's resource specifications includes: The second total allocatable resources of the host machine are determined based on the host machine physical resource specifications and the virtual machine resource specifications. The second over-allocation ratio is determined based on the second total amount of allocable resources.
6. The method according to claim 3, characterized in that, The step of determining the target over-proportion based on the first over-proportion and the second over-proportion includes: The minimum value among the first overmix ratio, the second overmix ratio, and the preset third overmix ratio is determined as the target overmix ratio.
7. The method according to claim 1, characterized in that, The step of determining the target over-provision ratio of the host machine when the load state is not overloaded, and adjusting the allocated resources of the host machine according to the target over-provision ratio, includes: Determine the current over-allocation ratio corresponding to the host machine; The comparison results are obtained based on the target over-proportion and the current over-proportion. The current over-proportioning ratio is updated based on the comparison results; Adjust the amount of resources allocated to the host machine based on the updated current over-provision ratio.
8. The method according to claim 7, characterized in that, The step of updating the current over-proportioning ratio based on the comparison results includes: If the comparison result shows that the target over-proportion is less than the current over-proportion, then reduce the current over-proportion. If the comparison result shows that the target over-ratio is greater than the current over-ratio, the current over-ratio is increased.
9. The method according to claim 8, characterized in that, The step of reducing the current over-proportion when the comparison result shows that the target over-proportion is less than the current over-proportion includes: The target reduction over-allocation ratio is determined based on the target over-allocation ratio, the current over-allocation ratio, and the preset maximum allocation rate; The current over-proportion ratio is updated based on the stated target, reducing the over-proportion ratio accordingly.
10. The method according to claim 8, characterized in that, The step of increasing the current over-ratio when the comparison result shows that the target over-ratio is greater than the current over-ratio includes: Determine whether the preset over-proportioning increase time is met at the current moment; If the preset over-allocation ratio increase time is met at the current moment, the target increase over-allocation ratio is determined from the target over-allocation ratio within the preset increase update cycle; The current over-proportion ratio is updated by increasing the over-proportion ratio according to the stated objective.
11. The method according to claim 1, characterized in that, The virtual machine migration process, performed when the load state is overloaded, includes: The host machine's resource pressure to be unloaded and the resource usage of each virtual machine are determined based on the host machine monitoring metrics. The virtual machines to be migrated are determined based on the host machine's resource pressure to be unloaded and the resource usage corresponding to the virtual machines. Migrate the virtual machine to be migrated.
12. The method according to claim 11, characterized in that, The migration of the virtual machine to be migrated includes: Determine the target host machine from the server cluster; The virtual machine to be migrated is migrated to the target host machine.
13. A resource adjustment device, characterized in that, The device is applied to a cloud platform, wherein a server cluster is deployed on the cloud platform, the server cluster includes multiple host machines, and each host machine includes at least one virtual machine. The device includes: The acquisition module is used to acquire the host machine monitoring metrics of the host machine; The load status determination module is used to determine the load status of the host machine based on the host machine monitoring indicators; the load status includes a non-overload status and an overload status. An adjustment module is used to determine the target over-provision ratio of the host machine when the load state is not overloaded, and adjust the allocated resources of the host machine according to the target over-provision ratio. The migration module is used to migrate virtual machines when the load state is overloaded.
14. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the resource adjustment method as described in claims 1-12.
15. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the resource adjustment method as described in claims 1-12.