Physical machine resource utilization rate balancing method and device, equipment and medium
Through regular detection and preset resource balance strategies, priority sorting and migration operations, the problem of unbalanced resource utilization in the data center is solved, automatic balance and optimization are achieved, and resource utilization and migration efficiency are improved.
Patent Information
- Application Number
- CN202510132012.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-05-13
AI Technical Summary
When dealing with the problem of unbalanced resource utilization in large-scale data centers, the existing technology faces challenges such as untimely or unreasonable resource allocation, unreasonable virtual machine migration strategies, lack of flexibility and scalability.
Through a physical machine resource utilization balance method, the target physical machine is regularly detected using the preset detection time, and the physical machine whose resource utilization is to be balanced is determined according to the preset resource balance strategy, the virtual machine is prioritized, and the preset checksum migration operation is performed until the preset balance standard is met.
It realizes automatic balance and optimization of the resource utilization rate of physical machines in the data center, improves overall resource utilization, ensures the efficiency and stability of the migration process, and reduces the risk of system failure and performance degradation.
Smart Images

Figure CN119987950A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and in particular to a method, device, equipment and medium for balancing the utilization rate of physical machine resources. Background Art
[0002] With the rapid development of cloud computing technology, large-scale data centers have become the core infrastructure supporting various cloud services. In a cloud environment, physical resources are virtualized to support the operation of multiple virtual machines (VMs). This virtualization technology greatly improves resource utilization and system flexibility. However, with the increasing number of virtual machines and the dynamic changes in business loads, the resource utilization of physical machines in data centers often becomes unbalanced. Some physical machines may face performance bottlenecks due to excessive loads, while other physical machines may be in a resource idle state.
[0003] Existing resource management technologies face many challenges in dealing with the problem of unbalanced utilization of physical machine resources in large-scale data centers. For example, traditional resource scheduling algorithms may not be able to accurately predict load changes, resulting in untimely or unreasonable resource allocation; virtual machine migration strategies may be too simple and fail to fully consider the migration overhead and the load capacity of the target host, thus affecting migration efficiency and system stability. In addition, existing technical solutions often lack flexibility and scalability when balancing the utilization of physical machine resources, and cannot be customized according to actual needs. Some solutions may not provide a pre-check mechanism, resulting in virtual machines that do not meet the migration conditions being mistakenly migrated, which in turn causes system failures or performance degradation. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a physical machine resource utilization balancing method, device, equipment and medium, which can solve the problems of unbalanced resource allocation, low resource utilization, unreasonable virtual machine migration strategy and so on in the prior art, and realize automatic balancing and optimization of physical machine resource utilization in the data center. The specific scheme is as follows:
[0005] In a first aspect, the present application provides a method for balancing physical machine resource utilization, including:
[0006] Regularly detecting the first target physical machine based on a preset detection time to obtain target detection data;
[0007] Determine a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data;
[0008] For any second target physical machine, the virtual machines in the second target physical machine are prioritized by using the preset resource balancing strategy, virtual machines are selected in descending order of priority for preset verification operations, and virtual machines that meet the verification requirements are used as virtual machines to be migrated. If the number of virtual machines to be migrated meets the preset migration conditions, the migration operation is performed on the virtual machines to be migrated;
[0009] If the second target physical machine after the migration operation does not meet the preset balance standard, jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource usage.
[0010] Optionally, the content of the target detection data includes central processing unit data of the physical machine, central processing unit data of the virtual machine, memory data of the physical machine, memory data of the virtual machine, disk input / output rate data and network bandwidth data.
[0011] Optionally, the periodically detecting the first target physical machine based on a preset detection time to obtain target detection data includes:
[0012] Determine a preset time range, and determine a first target physical machine that needs to perform a physical machine resource utilization balancing operation according to a preset resource balancing strategy;
[0013] The first target physical machine is detected periodically based on a preset detection time to obtain target detection data corresponding to the first target physical machine within the current preset time range.
[0014] Optionally, the using the preset resource balancing strategy to prioritize the virtual machines in the second target physical machine, selecting virtual machines in descending order of priority to perform a preset verification operation, and using virtual machines that meet the verification requirements as virtual machines to be migrated, and if the number of virtual machines to be migrated meets a preset migration condition, performing a migration operation on the virtual machines to be migrated, includes:
[0015] Prioritizing the virtual machines in the second target physical machine based on a preset virtual machine selection method in the preset resource balancing strategy;
[0016] In descending order of priority, select virtual machines from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation, save the virtual machines that meet the verification requirements into a list of virtual machines to be migrated as virtual machines to be migrated, and determine whether the current number of virtual machines to be migrated meets the preset migration condition;
[0017] If the preset migration condition is not met, jump to the step of selecting virtual machines from the virtual machines of the second target physical machine that have not been selected to perform the preset verification operation in order of priority from high to low, so as to continue to perform the preset verification operation on the remaining virtual machines;
[0018] If the preset migration condition is met, a migration operation is performed on the virtual machines to be migrated in the to-be-migrated list.
[0019] Optionally, the preset virtual machine selection method includes a random selection method, a selection method based on the virtual machine central processor usage, a selection method based on the virtual machine memory usage, a selection method based on the virtual machine's impact on the physical machine's central processor, and a selection method based on the virtual machine's impact on the physical machine's memory.
[0020] Optionally, before performing the migration operation on the virtual machine to be migrated, the method further includes:
[0021] Determine a source physical machine and a target physical machine in a migration operation; wherein the physical machine with the lowest resource utilization rate is used as the target physical machine;
[0022] Based on the target detection data of the source physical machine and the target detection data of the target physical machine, a migration order and a migration time corresponding to each virtual machine to be migrated in the to-be-migrated list are determined.
[0023] Optionally, the process of performing the migration operation on the virtual machine to be migrated further includes:
[0024] The source physical machine information and the target physical machine information corresponding to the migration operation of each virtual machine to be migrated and the migration result corresponding to the migration operation are saved, and the failure reason of the migration result indicating the failure is analyzed.
[0025] In a second aspect, the present application provides a physical machine resource utilization balancing device, comprising:
[0026] A data acquisition module, used to periodically detect the first target physical machine based on a preset detection time to obtain target detection data;
[0027] A physical machine determination module, configured to determine a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data;
[0028] A first virtual machine migration module is used to prioritize virtual machines in any second target physical machine by using the preset resource balancing strategy, select virtual machines in order of priority from high to low for preset verification operations, and use virtual machines that meet the verification requirements as virtual machines to be migrated, and if the number of virtual machines to be migrated meets the preset migration conditions, perform a migration operation on the virtual machines to be migrated;
[0029] The second virtual machine migration module is used to jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy if the second target physical machine does not meet the preset balance standard after the migration operation, until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource utilization.
[0030] In a third aspect, the present application provides an electronic device, including:
[0031] Memory, used to store computer programs;
[0032] The processor is used to execute the computer program to implement the aforementioned physical machine resource usage balancing method.
[0033] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned physical machine resource utilization balancing method when executed by a processor.
[0034] In the present application, the first target physical machine is detected periodically based on a preset detection time to obtain target detection data; the second target physical machine whose resource utilization is to be balanced is determined from the first target physical machine according to a preset resource balancing strategy and the target detection data; for any second target physical machine, the virtual machines in the second target physical machine are prioritized using the preset resource balancing strategy, virtual machines are selected in order of priority from high to low for preset verification operations, and virtual machines that meet the verification requirements are used as virtual machines to be migrated, and if the number of virtual machines to be migrated meets the preset migration conditions, the migration operation is performed on the virtual machines to be migrated; if the second target physical machine does not meet the preset balance standard after the migration operation, jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource utilization. As can be seen from the above, the present application dynamically adjusts the distribution of virtual machines on physical machines through an intelligent resource balancing strategy that is customized and configured in advance according to actual needs, so that the resource utilization rate of each physical machine tends to be balanced, thereby improving the overall resource utilization rate; on the other hand, the virtual machines in the second target physical machine are selected in order of priority from high to low for preset verification operations, and the virtual machines that meet the verification requirements are used as virtual machines to be migrated, and the migration operation is performed on the virtual machines to be migrated when the number of virtual machines to be migrated meets the preset migration conditions. In this way, by formulating a reasonable virtual machine migration strategy, the efficiency and stability of the migration process are ensured; at the same time, a pre-check mechanism is provided to perform preset verification operations on virtual machines, and virtual machines that meet the verification requirements are used as virtual machines to be migrated, so as to avoid the problem of virtual machines that do not meet the migration conditions being mistakenly migrated. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0036] Figure 1 A flow chart of a physical machine resource utilization balancing method disclosed in this application;
[0037] Figure 2 A schematic diagram of a specific physical machine resource utilization balancing method disclosed in this application;
[0038] Figure 3 A schematic diagram of a specific virtual machine pre-check disclosed in this application;
[0039] Figure 4A schematic diagram of a specific physical machine resource utilization balancing method module disclosed in this application;
[0040] Figure 5 A schematic diagram of a specific physical machine resource utilization balancing method disclosed in this application;
[0041] Figure 6 A schematic diagram of the structure of a physical machine resource utilization balancing device disclosed in this application;
[0042] Figure 7 This is a schematic diagram of the structure of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] Existing resource management technologies face many challenges in dealing with the problem of unbalanced physical machine resource utilization in large-scale data centers. For example, traditional resource scheduling algorithms may not be able to accurately predict load changes, resulting in untimely or unreasonable resource allocation; virtual machine migration strategies may be too simple and fail to fully consider migration overhead and the load capacity of the target host, thereby affecting migration efficiency and system stability. In addition, existing technical solutions often lack flexibility and scalability when balancing physical machine resource utilization, and cannot be customized according to actual needs. Some solutions may not provide a pre-check mechanism, resulting in virtual machines that do not meet the migration conditions being mistakenly migrated, which in turn causes system failures or performance degradation. To this end, the present application provides a physical machine resource utilization balancing method that can achieve automatic balancing and optimization of physical machine resource utilization in a data center through intelligent resource balancing strategies and virtual machine migration strategies.
[0045] See also Figure 1 As shown, the embodiment of the present application discloses a method for balancing the utilization rate of physical machine resources, including:
[0046] Step S11: regularly detect the first target physical machine based on a preset detection time to obtain target detection data.
[0047] In this embodiment, the scope of the physical machines that need to balance resource usage is first determined, that is, the first target physical machine, and the first target physical machine is regularly detected based on the preset detection time to obtain target detection data, and it is determined whether there is a physical machine in the first target physical machine that needs to balance resource usage according to the target detection data. Among them, the above-mentioned preset detection time can be set to different periods, such as 30 minutes, 1 hour, 2 hours, etc. If the preset detection time is 30 minutes, the first target physical machine will be detected every 30 minutes; the content of the above-mentioned target detection data includes the central processing unit data of the first target physical machine, the central processing unit data of the virtual machine in the first target physical machine, the memory data of the first target physical machine, the memory data of the virtual machine in the first target physical machine, the total memory of the first target physical machine, the disk input / output rate data and the network bandwidth data, etc.
[0048] Specifically, regularly detecting the first target physical machine based on a preset detection time to obtain target detection data may include: first determining a preset time range, and determining the first target physical machine that needs to perform a physical machine resource usage balancing operation according to a preset resource balancing strategy; then regularly detecting the first target physical machine based on the preset detection time to obtain target detection data corresponding to the first target physical machine within the current preset time range.
[0049] It should be noted that the content of the above-mentioned preset resource balancing strategy includes but is not limited to: setting the range of physical machines that need to balance resource utilization, that is, the CPU (Central Processing Unit) and memory resource utilization of which physical machines need to be balanced; setting the operation trigger threshold, that is, the physical machine CPU and memory resource utilization must be higher than a certain value to trigger the resource utilization balancing operation; setting the maximum threshold, that is, the CPU and memory utilization of the physical machine after balancing must be lower than a certain value. If only CPU resources are balanced, only the CPU utilization can be set; setting the virtual machine migration method, for example, whether the virtual machine performs hot migration or cold migration when performing migration, because hot migration does not require the virtual machine to be shut down, but cold migration requires the virtual machine to be shut down and then restarted after migration; setting the virtual machine selection method, including but not limited to random selection method, selection method based on virtual machine central processor utilization, selection method based on virtual machine memory utilization, selection method based on the virtual machine's impact on the physical machine's central processor, and selection method based on the virtual machine's impact on the physical machine's memory. For example, "Virtual machine with high CPU usage", "Virtual machine with high memory usage", "Virtual machine with high impact on physical machine CPU usage", "Virtual machine with high impact on physical machine memory usage", each method will prioritize the virtual machines on the physical machine. If "Virtual machine with high CPU usage" is selected, the virtual machines on the physical machine will be sorted from high to low according to "CPU usage", and the virtual machines with high "CPU usage" will be prioritized for migration. At the same time, the virtual machine selection method can be combined. After the combination is selected, each method will be sorted once to obtain different virtual machine priority sequences. The above different virtual machine priority sequences will be used according to the actual situation. If the physical machine after the migration operation using the current virtual machine priority sequence still needs to be balanced, continue to use other virtual machine priority sequences for migration.For example, if you select "Virtual machine with high CPU usage" or "Virtual machine with high memory usage", the virtual machines will be sorted by CPU usage first, and then by memory usage; set the execution cycle (that is, the preset detection time). If the execution cycle is 30 minutes, the physical machines under the preset resource balancing policy will be checked every 30 minutes to see whether they meet the threshold requirements. For example, if the CPU usage of the physical machine set in the preset resource balancing policy is lower than 80%, that is, the operation triggering threshold is 80%, and there are three physical machines A, B, and C at this time, the check program will check whether the CPU usage of the three physical machines A, B, and C does not exceed 80%. If so, the inspection task is completed. If the CPU usage of physical machine A reaches 82%, which is higher than the threshold, the balancing operation is triggered to balance the CPU resources on physical machine A, that is, migrate the virtual machine; set the average time of monitoring data (that is, the preset time range), such as "Real-time", "Recent 5 minutes", "Recent 10 minutes", "Recent half an hour", etc. If "Real-time" is selected, the monitoring data obtained is the latest monitoring data. If "Recent 5 minutes" is selected, the monitoring data obtained is the monitoring data within the last 5 minutes. Every time a new execution cycle is reached, the physical machine is detected to obtain the monitoring data (ie, target detection data) corresponding to the physical machine within the average time range of the current monitoring data.
[0050] It can be understood that this embodiment determines whether a balancing operation is needed based on the resource data of the physical machine, such as CPU, memory-related data, and the resource data of the virtual machine, such as CPU, memory-related data, and therefore needs to obtain the monitoring data of the above resources; wherein, the method of collecting data includes but is not limited to collecting and saving through open source tools such as Prometheus and Zabbix.
[0051] Step S12: determining a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data.
[0052] In this embodiment, all physical machines under the preset resource balancing policy are monitored to obtain monitoring data, and based on the monitoring data, it is determined whether there is a second target physical machine to be balanced whose resource usage exceeds a threshold set by the policy.
[0053] Step S13: For any second target physical machine, use the preset resource balancing strategy to prioritize the virtual machines in the second target physical machine, select virtual machines in order of priority from high to low for preset verification operations, and use the virtual machines that meet the verification requirements as virtual machines to be migrated. If the number of virtual machines to be migrated meets the preset migration conditions, perform the migration operation on the virtual machines to be migrated.
[0054] In this embodiment, first, the virtual machines in the second target physical machine are prioritized based on the preset virtual machine selection method in the preset resource balancing policy; then, in order of priority from high to low, virtual machines are selected from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation, and the virtual machines that meet the verification requirements are saved in the list of virtual machines to be migrated as virtual machines to be migrated, and it is determined whether the current number of virtual machines to be migrated meets the preset migration conditions; if the preset migration conditions are not met, jump to the step of selecting virtual machines from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation in order from high to low priority, so as to continue to perform the preset verification operation on the remaining virtual machines; if the preset migration conditions are met, the migration operation is performed on the virtual machines to be migrated in the list of virtual machines to be migrated.
[0055] Understandably, see Figure 2 As shown, according to the virtual machine selection method in the preset resource balancing policy, the virtual machines on the second target physical machine are prioritized, and virtual machines with high priorities are selected in order from high to low priorities for pre-check (i.e., the preset verification operation). If the pre-check passes, the virtual machine is added to the list to be migrated, and then it is determined whether the current number of virtual machines to be migrated meets the preset migration conditions. If the preset migration conditions are not met, virtual machines continue to be selected for pre-check until the current number of virtual machines to be migrated in the list to be migrated meets the preset migration conditions.
[0056] For the above pre-checks, see Figure 3 The virtual machine pre-check diagram shown in the figure, the virtual machine pre-check consists of multiple check items, each check item is a screening condition, the purpose is to screen out virtual machines that meet the migration conditions, and the virtual machine must meet each check item. If the virtual machine fails in the pre-check, the virtual machine will not appear in the list to be migrated. For example, check item 1: Check whether the virtual machine status is migratable. This step checks whether the current status of the virtual machine meets the migration conditions. For example, only when the virtual machine status is active (i.e., running status) can it be migrated, and if the virtual machine status is other, it cannot be migrated; check item 2: Check whether the virtual machine has a destination host. This step checks whether other physical machines can meet the conditions for the migration of the virtual machine, such as whether the memory and CPU of the physical machine can meet the requirements of the virtual machine to be migrated; check item 3: Check whether there is critical alarm information. If there is critical alarm information in the environment, it means that there is a problem with the environment and the conditions for virtual machine migration are not met. If the migration operation is performed, adverse consequences may occur; check item 4: Check whether the CPU of the source host is consistent with that of the destination host. For hot migration, the CPU on the source host must be consistent with the CPU on the destination host, otherwise the migration will fail. By performing a pre-check on the virtual machine, you can check the availability of the destination host and the migration conditions to ensure the security and effectiveness of the migration operation.
[0057] It should be noted that before performing the migration operation on the virtual machine to be migrated, the following may also be included: first, determining the source physical machine and the target physical machine (i.e., the destination host) in the migration operation; wherein, the physical machine with the lowest resource utilization rate is used as the target physical machine; and then, based on the target detection data of the source physical machine and the target detection data of the target physical machine, determining the migration order and migration time corresponding to each virtual machine to be migrated in the list to be migrated.
[0058] It is understandable that selecting a physical machine with a higher resource utilization rate as the source physical machine, selecting a physical machine with a lower resource utilization rate as the target physical machine, and formulating the order and timing of virtual machine migration according to the load of the source physical machine and the target physical machine will help improve the efficiency of the balancing operation. At the same time, the impact of the migration operation on the source physical machine, the target physical machine and the stability of the entire system can also be evaluated, and the evaluation results can be sent to relevant managers.
[0059] In this embodiment, when performing a migration operation on the virtual machines to be migrated in the migration list, the virtual machine migration operation can be triggered by executing a virtual machine migration command or by calling an interface; at the same time, the source physical machine information, target physical machine information corresponding to each virtual machine to be migrated when performing the migration operation, and the corresponding migration result after the migration operation can be saved, and the failure reason represented by the migration result can be analyzed.
[0060] Step S14: If the second target physical machine after the migration operation does not meet the preset balance standard, jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource usage.
[0061] In this embodiment, after the migration operation is completed, it is necessary to determine whether the second target physical machine meets the preset balance standard. The preset balance standard can be a series of pre-set rules or indicators used to measure the balance of physical machine resource usage, such as the thresholds of physical machine CPU usage, physical machine memory usage, disk I / O and other resource usage. If the resource usage of the second target physical machine in these aspects does not reach the preset reasonable range, it is determined that the preset balance standard is not met. At this time, it is necessary to repeat the above steps of using the preset resource balancing strategy to prioritize the virtual machines in the second target physical machine until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource usage.
[0062] As can be seen from the above, this embodiment dynamically adjusts the distribution of virtual machines on physical machines through an intelligent resource balancing strategy that is customized and configured in advance according to actual needs, so that the resource utilization rate of each physical machine tends to be balanced, thereby improving the overall resource utilization rate; on the other hand, the virtual machines in the second target physical machine are selected in order of priority from high to low for preset verification operations, and the virtual machines that meet the verification requirements are used as virtual machines to be migrated, and the migration operation is performed on the virtual machines to be migrated when the number of virtual machines to be migrated meets the preset migration conditions. In this way, by formulating a reasonable virtual machine migration strategy, the efficiency and stability of the migration process are ensured, and the system performance degradation or failure caused by the migration operation is reduced, thereby further enhancing the stability and reliability of the system; at the same time, a pre-check mechanism is provided to perform preset verification operations on virtual machines, and virtual machines that meet the verification requirements are used as virtual machines to be migrated, so as to avoid the problem of virtual machines that do not meet the migration conditions being mistakenly migrated. Furthermore, through rich configuration options, users can customize the configuration according to actual needs to meet the resource balancing needs in different scenarios, and also facilitate the expansion and upgrade of the system so that it can adapt to the ever-changing cloud environment needs.
[0063] See also Figure 4 As shown, the embodiment of the present application includes the following modules:
[0064] Policy module: used to add, edit, and save data in the physical machine resource balancing policy, such as the source physical machine CPU usage, the source physical machine memory resource usage, the CPU usage of the migrated physical machine, the memory usage of the migrated physical machine, the virtual machine migration method, the virtual machine selection method, the execution cycle, and other data.
[0065] Monitoring data collection module: used to collect monitoring data of physical machines and virtual machines, such as physical machine CPU usage, physical machine memory usage, physical machine total memory, virtual machine CPU usage, virtual machine memory usage, etc. The collected monitoring data can be saved in the database table for use by other modules.
[0066] Scheduled task module: This module will periodically check whether the physical machines under the preset resource balancing strategy meet the threshold requirements based on the preset execution cycle according to the threshold set in the resource balancing strategy, and further determine whether to trigger the execution of the balancing operation.
[0067] Pre-check module: This module consists of multiple pre-check items. Each check item is a screening condition. The purpose is to screen out virtual machines that meet the migration conditions. If a virtual machine fails the check in this module, it will not appear in the list to be migrated.
[0068] Virtual machine migration module: This module triggers the migration operation of the virtual machine by executing the virtual machine migration command or through interface calls. Only virtual machines that pass the pre-check will enter this module.
[0069] Migration record module: This module records the migration results of each virtual machine, the source host and destination host of the migration operation, and other information. For virtual machines that fail to migrate, the detailed reasons for the migration failure are recorded.
[0070] As can be seen from the above, this embodiment ensures the efficiency and security of the resource balancing process through the coordinated work of the policy module, monitoring data collection module, scheduled task module, pre-check module, virtual machine migration module and migration record module. In this way, through flexible policy settings, accurate monitoring data collection, strict pre-check and detailed migration records, the automatic optimization of physical machine resource utilization in the cloud environment is achieved, and the overall performance and stability of the cloud platform are improved.
[0071] See also Figure 5 As shown, an embodiment of the present application discloses a schematic diagram of a specific method for balancing physical machine resource utilization.
[0072] In this embodiment, a preset resource balancing strategy is first set, and then the first target physical machine under the preset resource balancing strategy is periodically detected based on the preset detection time to obtain monitoring data, so as to periodically check whether there is a physical machine that needs to perform a balancing operation in the first target physical machine at this time based on the monitoring data. If there is a physical machine that needs to perform a balancing operation in the first target physical machine, the physical machine that needs to be balanced is determined, and for any of the above-mentioned second target physical machines that need to be balanced, the virtual machines in the second target physical machine are prioritized using the preset resource balancing strategy, and then the virtual machines are selected in order from high to low priority for the preset verification operation, and the virtual machines that meet the verification requirements are saved in the list to be migrated to determine the virtual machines that need to be migrated, and if the number of virtual machines to be migrated meets the preset migration conditions, the migration operation is performed on the virtual machines to be migrated, and the migration results are recorded.
[0073] As can be seen from the above, this embodiment realizes automatic balancing and optimization of the utilization rate of physical machine resources in a data center through intelligent resource balancing strategy and virtual machine migration strategy.
[0074] See also Figure 6 As shown, the embodiment of the present application also discloses a physical machine resource utilization balancing device, including:
[0075] A data acquisition module 11 is used to periodically detect the first target physical machine based on a preset detection time to obtain target detection data;
[0076] A physical machine determination module 12, configured to determine a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data;
[0077] The first virtual machine migration module 13 is used to prioritize the virtual machines in any second target physical machine by using the preset resource balancing strategy, select virtual machines in order of priority from high to low for preset verification operations, and use the virtual machines that meet the verification requirements as virtual machines to be migrated. If the number of virtual machines to be migrated meets the preset migration conditions, the migration operation is performed on the virtual machines to be migrated;
[0078] The second virtual machine migration module 14 is used to jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy if the second target physical machine does not meet the preset balance standard after the migration operation, until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource utilization.
[0079] As can be seen from the above, the present application dynamically adjusts the distribution of virtual machines on physical machines through an intelligent resource balancing strategy that is customized and configured in advance according to actual needs, so that the resource utilization rate of each physical machine tends to be balanced, thereby improving the overall resource utilization rate and reducing the operating costs of the data center; on the other hand, the virtual machines in the second target physical machine are selected in order of priority from high to low for preset verification operations, and the virtual machines that meet the verification requirements are used as virtual machines to be migrated, and the migration operation is performed on the virtual machines to be migrated when the number of virtual machines to be migrated meets the preset migration conditions. In this way, by formulating a reasonable virtual machine migration strategy, the efficiency and stability of the migration process are ensured; at the same time, a pre-check mechanism is provided to perform preset verification operations on virtual machines, and virtual machines that meet the verification requirements are used as virtual machines to be migrated, so as to avoid the problem of virtual machines that do not meet the migration conditions being mistakenly migrated. Furthermore, the present application reduces resource bottlenecks and waste and improves the performance and stability of cloud services by automatically balancing the utilization rate of physical machine resources, which not only improves the user experience, but also effectively reduces the operating costs of data centers, bringing significant economic benefits to enterprises; and, the intelligent and automated resource scheduling and virtual machine migration reduce the possibility of manual intervention and misoperation, improve operation and maintenance efficiency and management level, and make data center management more convenient and efficient.
[0080] In some specific implementations, the content of the target detection data includes the central processing unit data of the physical machine, the central processing unit data of the virtual machine, the memory data of the physical machine, the memory data of the virtual machine, the disk input / output rate data and the network bandwidth data.
[0081] In some specific implementations, the data acquisition module 11 includes:
[0082] A first physical machine determination unit, used to determine a preset time range, and determine a first target physical machine that needs to perform a physical machine resource usage balancing operation according to a preset resource balancing strategy;
[0083] The data acquisition unit is used to periodically detect the first target physical machine based on a preset detection time to obtain target detection data corresponding to the first target physical machine within the current preset time range.
[0084] In some specific implementations, the first virtual machine migration module 13 includes:
[0085] A sorting unit, configured to prioritize the virtual machines in the second target physical machine based on a preset virtual machine selection method in the preset resource balancing policy;
[0086] a judgment unit, configured to select virtual machines from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation in order of priority from high to low, and save the virtual machines that meet the verification requirements into a list of virtual machines to be migrated as virtual machines to be migrated, and judge whether the current number of virtual machines to be migrated meets the preset migration condition;
[0087] A first processing unit is configured to jump to the step of selecting virtual machines from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation if the preset migration condition is not met, so as to continue to perform the preset verification operation on the remaining virtual machines;
[0088] The second processing submodule is configured to perform a migration operation on the virtual machines to be migrated in the to-be-migrated list if the preset migration condition is met.
[0089] In some specific embodiments, the preset virtual machine selection method includes a random selection method, a selection method based on the virtual machine central processor usage rate, a selection method based on the virtual machine memory usage rate, a selection method based on the virtual machine's impact on the physical machine's central processor rate, and a selection method based on the virtual machine's impact on the physical machine's memory rate.
[0090] In some specific implementations, the second processing submodule further includes:
[0091] A second physical machine determination unit, used to determine a source physical machine and a target physical machine in a migration operation; wherein the physical machine with the lowest resource utilization rate is used as the target physical machine;
[0092] The information determination unit is used to determine the migration order and migration time corresponding to each to-be-migrated virtual machine in the to-be-migrated list based on the target detection data of the source physical machine and the target detection data of the target physical machine.
[0093] In some specific implementations, the physical machine resource usage balancing device further includes:
[0094] The data storage unit is used to store the source physical machine information and the target physical machine information corresponding to each virtual machine to be migrated when performing the migration operation and the corresponding migration result after the migration operation, and analyze the failure reason of the migration result representation failure.
[0095] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0096] Figure 7 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the physical machine resource utilization balancing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0097] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0098] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0099] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the physical machine resource utilization balancing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0100] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed physical machine resource utilization balancing method is implemented. The specific steps of the method can be referred to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0101] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0102] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0103] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0104] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0105] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for balancing physical machine resource utilization, characterized in that: include: Regularly detecting the first target physical machine based on a preset detection time to obtain target detection data; Determine a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data; For any second target physical machine, the virtual machines in the second target physical machine are prioritized by using the preset resource balancing strategy, virtual machines are selected in descending order of priority for preset verification operations, and virtual machines that meet the verification requirements are used as virtual machines to be migrated. If the number of virtual machines to be migrated meets the preset migration conditions, the migration operation is performed on the virtual machines to be migrated; If the second target physical machine after the migration operation does not meet the preset balance standard, jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource usage.
2. The physical machine resource utilization balancing method according to claim 1, characterized in that: The content of the target detection data includes the central processing unit data of the physical machine, the central processing unit data of the virtual machine, the memory data of the physical machine, the memory data of the virtual machine, the disk input / output rate data and the network bandwidth data.
3. The physical machine resource utilization balancing method according to claim 1, characterized in that: The periodically detecting the first target physical machine based on the preset detection time to obtain target detection data includes: Determine a preset time range, and determine a first target physical machine that needs to perform a physical machine resource utilization balancing operation according to a preset resource balancing strategy; The first target physical machine is detected periodically based on a preset detection time to obtain target detection data corresponding to the first target physical machine within the current preset time range.
4. The physical machine resource utilization balancing method according to claim 1, characterized in that: The method of using the preset resource balancing strategy to prioritize the virtual machines in the second target physical machine, selecting virtual machines in descending order of priority to perform a preset verification operation, and using virtual machines that meet the verification requirements as virtual machines to be migrated, and performing a migration operation on the virtual machines to be migrated if the number of virtual machines to be migrated meets the preset migration condition, includes: Prioritizing the virtual machines in the second target physical machine based on a preset virtual machine selection method in the preset resource balancing strategy; In descending order of priority, select virtual machines from the virtual machines of the second target physical machine that have not been selected to perform a preset verification operation, save the virtual machines that meet the verification requirements into a list of virtual machines to be migrated as virtual machines to be migrated, and determine whether the current number of virtual machines to be migrated meets the preset migration condition; If the preset migration condition is not met, jump to the step of selecting virtual machines from the virtual machines of the second target physical machine that have not been selected to perform the preset verification operation in order of priority from high to low, so as to continue to perform the preset verification operation on the remaining virtual machines; If the preset migration condition is met, a migration operation is performed on the virtual machines to be migrated in the to-be-migrated list.
5. The physical machine resource utilization balancing method according to claim 4, characterized in that: The preset virtual machine selection method includes a random selection method, a selection method based on the virtual machine central processor usage rate, a selection method based on the virtual machine memory usage rate, a selection method based on the virtual machine's impact on the physical machine's central processor rate, and a selection method based on the virtual machine's impact on the physical machine's memory rate.
6. The physical machine resource utilization balancing method according to claim 4, characterized in that: Before performing the migration operation on the virtual machine to be migrated, the method further includes: Determine a source physical machine and a target physical machine in a migration operation; wherein the physical machine with the lowest resource utilization rate is used as the target physical machine; Based on the target detection data of the source physical machine and the target detection data of the target physical machine, a migration order and a migration time corresponding to each virtual machine to be migrated in the to-be-migrated list are determined.
7. The physical machine resource utilization balancing method according to any one of claims 1 to 6, characterized in that: The process of performing the migration operation on the virtual machine to be migrated also includes: The source physical machine information and the target physical machine information corresponding to the migration operation of each virtual machine to be migrated and the migration result corresponding to the migration operation are saved, and the failure reason of the migration result indicating the failure is analyzed.
8. A physical machine resource utilization balancing device, characterized in that: include: A data acquisition module, used to periodically detect the first target physical machine based on a preset detection time to obtain target detection data; A physical machine determination module, configured to determine a second target physical machine whose resource usage is to be balanced from the first target physical machine according to a preset resource balancing strategy and the target detection data; A first virtual machine migration module is used to prioritize virtual machines in any second target physical machine by using the preset resource balancing strategy, select virtual machines in order of priority from high to low for preset verification operations, and use virtual machines that meet the verification requirements as virtual machines to be migrated, and if the number of virtual machines to be migrated meets the preset migration conditions, perform a migration operation on the virtual machines to be migrated; The second virtual machine migration module is used to jump to the step of prioritizing the virtual machines in the second target physical machine using the preset resource balancing strategy if the second target physical machine does not meet the preset balance standard after the migration operation, until the second target physical machine meets the preset balance standard to automatically balance the physical machine resource utilization.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the physical machine resource usage balancing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the physical machine resource usage balancing method as described in any one of claims 1 to 7.
Citation Information
Cited By
Cloud platform GPU virtual machine scheduling method and device
CN120234099A
A cloud platform GPU virtual machine scheduling method and device
CN120234099B