Resource management method and device and electronic equipment
By filtering the source and destination master machines in the physical machine, and using thermal migration technology to migrate the child machine to a physical machine with sufficient resources, the problem of low resource utilization is solved, and efficient resource management and cost reduction are achieved.
Patent Information
- Application Number
- CN202410089683.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-22
- Publication Date
- 2025-07-22
AI Technical Summary
Existing resource management methods lead to low resource utilization, inability to effectively utilize fragmented resources, and high operating costs.
By obtaining the load information and resource information of the child machine in each physical machine, the migable source and the unmigable destination machine are selected, and the child machine is migrated to a physical machine with sufficient resources and fragmented resources are used to realize the secondary scheduling management of resources.
It improves resource utilization, reduces fragmented resources, integrates large-scale resource space, and reduces operating costs.
Smart Images

Figure CN120353567A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a resource management method, apparatus, and electronic device. Background Art
[0002] With the development of computer technology, the requirements for data processing volume and data processing speed are constantly increasing. How to reasonably manage and allocate computer resources and improve resource utilization has attracted more and more attention.
[0003] Generally, most resource management methods analyze the virtual machine inventory in the live network manually. When the inventory in the live network is insufficient, they will first check whether there are completely empty physical machines offline that can be put into use. If there are physical machines of the same type offline, they will be put online to supplement resources. If there are no resources offline, they will try to relocate resources from other regions. When neither offline placement nor relocation can solve the resource gap in the live network, they will propose to purchase new physical machines to supplement resources to meet the operation requirements. The whole process is cumbersome and costly. The utilization rate of the overall physical machines is low, and moreover, there are more and more fragmented resources that cannot be utilized, resulting in relatively serious overall resource waste.
[0004] Therefore, how to provide a resource management solution that can improve resource utilization is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0005] Embodiments of this specification provide a resource management method, apparatus, device, storage medium, and computer program product, which improve resource utilization.
[0006] On the one hand, embodiments of this specification provide a resource management method, and the method includes:
[0007] Obtain the load information and resource information of the sub-machines in each physical machine;
[0008] According to the load information and resource information of the sub-machines in each physical machine, screen out the physical machines to which the sub-machines can be migrated as the source parent machines, and use the physical machines to which the sub-machines cannot be migrated as the destination parent machines;
[0009] Successively use the sub-machines in each source parent machine as the sub-machines to be migrated, and according to the resource information of the sub-machines to be migrated, use the destination parent machines whose idle resources are greater than or equal to the resource information of the sub-machines to be migrated and whose idle resources belong to fragmented resources as the destination parent machines corresponding to the sub-machines to be migrated;
[0010] Hot migrate each sub-machine to be migrated in each source parent machine to the corresponding destination parent machine.
[0011] On the other hand, a resource management device is provided, and the device includes:
[0012] A slave machine information acquisition module, configured to acquire the load information and resource information of slave machines in each physical machine;
[0013] A master machine division module, configured to screen out the physical machines to which the slave machines can be migrated as source master machines according to the load information and resource information of the slave machines in each physical machine, and use the physical machines to which the slave machines cannot be migrated as destination master machines;
[0014] A resource scheduling module, configured to sequentially use the slave machines in each source master machine as slave machines to be migrated, and according to the resource information of the slave machines to be migrated, use the destination master machines in which the free resources are greater than or equal to the resource information of the slave machines to be migrated and the free resources belong to fragmented resources as the destination master machines corresponding to the slave machines to be migrated;
[0015] A resource migration module, configured to hot migrate each slave machine to be migrated in each source master machine to the corresponding destination master machine.
[0016] On the other hand, a resource management system is provided, and the system includes: a resource selector and a resource scheduler, where:
[0017] The resource selector is configured to acquire the load information and resource information of slave machines in each physical machine, and screen out the physical machines to which the slave machines can be migrated as source master machines according to the load information and resource information of the slave machines in each physical machine, and use the physical machines to which the slave machines cannot be migrated as destination master machines;
[0018] The resource scheduler is configured to sequentially use the slave machines in each source master machine as slave machines to be migrated, and according to the resource information of the slave machines to be migrated, use the destination master machines in which the free resources are greater than or equal to the resource information of the slave machines to be migrated and the free resources belong to fragmented resources as the destination master machines corresponding to the slave machines to be migrated, and hot migrate each slave machine to be migrated in each source master machine to the corresponding destination master machine.
[0019] On the other hand, an electronic device is provided, including: a processor;
[0020] A memory for storing executable instructions of the processor;
[0021] Wherein, the processor is configured to execute the instructions to implement the resource management method described in any one of the above.
[0022] On the other hand, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above resource management methods.
[0023] On the other hand, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the resource management method provided in the above various alternative implementations.
[0024] The resource management method, device, equipment, storage medium, and computer program product provided in the embodiments of this specification have the following technical effects:
[0025] The resource management method provided in the embodiments of this specification can, based on the load information and resource information of the sub-machines in each physical machine, divide the physical machines to which the sub-machines can be migrated into source-end master machines, and divide the physical machines to which the sub-machines cannot be migrated into destination-end master machines. Then, based on the resource information of each sub-machine in the source-end master machines, select the physical machines with sufficient resource space and fragmented resources in the destination-end master machines as the target master machines to be migrated into, and then migrate the sub-machines to be migrated in the source-end master machines to the corresponding target master machines to be migrated into through the hot migration technology. By migrating the sub-machines in the source-end master machines to the destination-end master machines with sufficient resource space and fragmented resources through the hot migration technology, the secondary scheduling management of the resources in each physical machine is realized. It can not only fill the fragmented resources in the destination-end master machines, reduce the fragmented resources in the physical machines, but also release the resources in the source-end master machines, integrate large-scale resource spaces for subsequent use, improve the resource utilization rate, and reduce the cost of resource management. Description of the Drawings
[0026] To more clearly illustrate the technical solutions and advantages in the embodiments of this specification or the prior art, the following will briefly introduce the drawings required to be used in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0027] Figure 1 It is a schematic diagram of the application environment of a resource management method provided in the embodiments of this specification;
[0028] Figure 2 It is a schematic flowchart of a resource management method provided in an embodiment of this specification;
[0029] Figure 3It is a schematic diagram of the screening process of the source master in an embodiment of this specification;
[0030] Figure 4 It is a schematic diagram of the selection process of the migratable master in an embodiment of this specification;
[0031] Figure 5 It is a schematic diagram of the hot migration process in an embodiment of this specification;
[0032] Figure 6 It is a schematic diagram of the principle structure of the resource management system in an embodiment of this specification;
[0033] Figure 7 It is a schematic diagram of the structure of a resource management device provided in an embodiment of this specification;
[0034] Figure 8 It is a block diagram of an electronic device for resource management provided in an embodiment of this specification;
[0035] Figure 9 It is another block diagram of an electronic device for resource management provided in an embodiment of this specification. Detailed implementation manners
[0036] Next, the technical solutions in the embodiments of this specification will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.
[0037] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this specification and the above accompanying drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this specification described here can be implemented in an order different from those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0038] Please refer to Figure 1 , Figure 1 It is a schematic diagram of the application environment of a resource management method provided in an embodiment of this specification. The application environment can at least include a server 100 and a terminal 200.
[0039] In an optional embodiment, the server 100 can be used to receive data sent by the terminal 200, such as information related to the physical machines in the terminal. The server 100 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0040] In an optional embodiment, the terminal 200 can be a terminal device that sends data to the server 100. The terminal 200 can be an electronic device of types such as a smart phone, a desktop computer, a tablet computer, a laptop computer, a smart wearable device, a vehicle-mounted device, etc.; it can also be software running on the above-mentioned electronic devices, such as application programs, applets, etc. The operating systems running on the electronic devices in the embodiments of this specification can include, but are not limited to, Android system, IOS system, linux, windows, etc.
[0041] In addition, it should be noted that Figure 1 The figure shown is only a schematic diagram of the application environment of a resource management method, and the embodiments of this specification are not limited thereto.
[0042] In the embodiments of this specification, the above-mentioned server 100 and terminal 200 can be directly or indirectly connected through wired or wireless communication methods, and the embodiments of this specification do not make any restrictions here.
[0043] In the public cloud or private cloud scenarios, resource management is of great significance for realizing high-performance computing, cloud computing, distributed systems and other fields. However, traditional resource management methods have many deficiencies, such as lack of flexibility, low efficiency and difficulty in expansion. In resource operation, the cost of physical servers accounts for the vast majority of the total cost. How to effectively improve resource utilization has become a major problem in the industry. The optimal bin packing at the first scheduling will schedule the user's virtual machines to the optimal mother machines at the first creation, but the uncertainty of the user's elastic resource demand and the creation and destruction brought by tidal purchases gradually generate fragmented resources. When the number of physical servers is limited, the increase in fragmented resources leads to a reduction in the types of sellable sub-machines, resulting in a large amount of resource waste. Adding new physical machines was the most commonly used operation method in the past, but it will increase unnecessary operation costs. When there are a large number of fragmented resources and there is a shortage of large-scale virtual machine inventories, adding new physical machines will increase the operation cost greatly and cause a large amount of waste of fragmented resources.
[0044] The resource management method in the embodiments of this specification can mainly schedule and manage resources (such as hard disks, memory, kernels, etc.) in each physical device. Through the live migration technology, virtual machines on physical servers are live migrated, shuffled, and integrated to form a complete set of secondary scheduling systems for migration. On the one hand, it can fill fragmented resources, and on the other hand, it can release resources on the source physical machine. Finally, a completely empty physical server or a large-scale resource space is integrated, reducing the deployment of physical machines, greatly improving resource utilization, and reducing operating costs.
[0045] The following introduces a resource management method in the embodiments of this specification. Figure 2 It is a schematic flowchart of a resource management method provided by an embodiment of this specification. This specification provides method operation steps such as in the embodiment or flowchart, but based on routine or non-creative labor, it may include more or fewer operation steps. The step order listed in the embodiment is only one way among the execution orders of numerous steps and does not represent the only execution order. When the actual system or server product executes, it can be executed in the order shown in the embodiment or the drawing or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing). This method can be applied to terminals such as computers, tablets, smart phones, smart wearable devices, in-vehicle devices, etc. Of course, according to actual needs, it can also be applied in servers. The embodiments of this specification do not make specific limitations on this. Specifically, as Figure 2 shown, the method may include:
[0046] S202: Obtain the load information and resource information of the sub-machines in each physical machine.
[0047] In the specific implementation process, as the amount of data processing continues to increase, the devices for data processing are also increasing. Multiple devices such as server clusters can be used for data processing to improve the speed and accuracy of data processing. With the development and progress of technology, cloud computing is used more and more. Cloud computing decomposes huge data computing programs into countless small programs through the network cloud, and then processes and analyzes these small programs through a system composed of multiple servers to obtain results and return them to users. Cloud computing consists of a series of resources that can be dynamically upgraded and virtualized. These resources are shared by all cloud computing users and can be conveniently accessed through the network. Users do not need to master the technology of cloud computing and only need to lease cloud computing resources according to personal or group needs. The resource management method in the embodiments of this specification can be applied to cloud computing systems to reasonably schedule or allocate resources in cloud computing systems and improve resource utilization.
[0048] When performing resource management, the load information and resource information of the child machines in each physical machine in the existing network can be obtained first. Here, a physical machine can be understood as an entity device such as a server or a terminal device in a cloud computing system, and a child machine can be understood as a virtual machine in a physical machine. A virtual machine refers to a complete computer system with the functions of a complete hardware system simulated by software and running in a completely isolated environment. All the work that can be completed on a physical computer can be achieved in a virtual machine. When creating a virtual machine in a computer, a part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent CMOS (Complementary Metal Oxide Semiconductor, a readable and writable chip), hard disk, and operating system, and the virtual machine can be operated in the same way as a physical machine. Usually, in computing systems such as cloud computing, virtualization technology can be used to allocate the resources in a physical machine to multiple virtual machines for use. The essence of virtualization is a resource management technology, which can convert and abstract the physical resources of a computer (such as CPU (Central Processing Unit), RAM (Random Access Memory), network, etc.) through various technical means, so that these resources can be re-segmented, arranged, and combined to achieve the purpose of maximizing the use of physical resources.
[0049] It can be seen that there can be one or more child machines on each physical machine, and each child machine corresponds to the load information and resource information of the child machine. The load information can be understood as the current maximum computing power of the child machine or the computing power that has been occupied by the child machine currently. The resource information can be understood as the size of the resources allocated to the child machine, such as the kernel size, or the memory space size, etc., which can be determined according to actual needs specifically, and the embodiments of this specification do not make specific limitations. When performing resource management, the list of child machines on each physical machine in the existing network can be obtained first, and then the load information and resource information corresponding to each child machine can be obtained based on the list.
[0050] S204: According to the load information and resource information of the child machines in each physical machine, filter out the physical machines to which the child machines can be migrated as the source parent machines, and use the physical machines to which the child machines cannot be migrated as the destination parent machines.
[0051] In a specific implementation process, after obtaining the load information and resource information of the child machines in each physical machine, it is possible to determine whether each child machine can be migrated based on the load information and resource information of each child machine. If a child machine can be migrated, it means that the child machine can be migrated from one physical machine to another. Generally, in order to ensure the efficiency and security of virtual machine migration, in the embodiments of this specification, child machines with small cores can be used as migratable child machines, or child machines with low load and small cores can be used as migratable child machines. Based on the load information and resource information of each child machine, the physical machines to which the child machines can be migrated can be screened out as the source parent machines, and the physical machines to which the child machines cannot be migrated can be used as the destination parent machines.
[0052] In some embodiments of this specification, according to the load information and resource information of the child machines in each physical machine, the physical machines to which the child machines can be migrated are screened out as the source parent machines, and the physical machines to which the child machines cannot be migrated are used as the destination parent machines, including:
[0053] According to the load information and resource information of the child machines in each physical machine, the child machines with load information less than the preset load and resource information less than the first preset resource amount are used as migratable child machines;
[0054] The physical machines in which all child machines are migratable child machines are used as the source parent machines;
[0055] The physical machines in which there is at least one non-migratable child machine are used as the destination parent machines.
[0056] In a specific implementation process, when screening physical machines, it is possible to first determine whether the child machines on each physical machine belong to migratable child machines based on the load information and resource information of the child machines on each physical machine. In the embodiments of this specification, the child machines with load information less than the preset load and resource information less than the first preset resource amount can be used as migratable child machines. Among them, the specific values of the preset load and the first preset resource amount can be set according to the actual situation, and the embodiments of this specification do not make specific limitations. For example: the preset load can be set to 30% of the current load of the child machine accounting for all the loads of the child machine, and the first preset resource amount can be set to 16 cores or 8 cores, etc. After determining whether the child machines on each physical machine belong to migratable child machines, the physical machines in which all child machines are migratable can be used as the source parent machines, and the physical machines in which there is at least one non-migratable child machine can be used as the destination parent machines.
[0057] Figure 3 It is a schematic diagram of the screening process of the source parent machine in an embodiment of this specification, such as Figure 3As shown, in some scenario examples, the list of child machines on each physical machine can be obtained in sequence, and it can be determined in sequence whether each child machine can be migrated. If there is a child machine that cannot be migrated, the process ends directly. If all child machines can be migrated, resource release simulation can be performed, that is, it is assumed that the child machines on the physical machine are migrated to see how much resource space can be released. The resource release simulation is performed on each migratable child machine in sequence to determine whether the physical machine can be emptied. If it can be emptied, the physical machine is marked as the source-end master machine. If the physical machine cannot be emptied, the process ends directly. Usually, if all the child machines on a physical machine can be migrated, the physical machine can be emptied when performing resource release simulation. The simulation of resource release can align data at the master machine level and the management and control level to ensure the accuracy of resource management.
[0058] In the embodiments of this specification, the child machines with low load and small cores are used as migratable child machines, which is convenient for the subsequent migration of child machines and can improve the efficiency and accuracy of data migration. Moreover, the physical machines from which all child machines can be migrated are selected as the source-end master machines. In this way, in subsequent resource management, all the child machines of the source-end master machines can be migrated out, emptying the source-end master machines, and integrating to obtain a physical machine with a relatively large resource space. Then, subsequent relocation or sale can be carried out, and there is no need to purchase new physical machines, which improves resource utilization and reduces the cost of resource management.
[0059] S206: Take the child machines in each source-end master machine as the child machines to be migrated in sequence. According to the resource information of the child machines to be migrated, use the destination-end master machines whose free resources are greater than or equal to the resource information of the child machines to be migrated and whose free resources are fragmented resources as the destination master machines corresponding to the child machines to be migrated.
[0060] In a specific implementation process, after dividing each physical machine into a source master machine and a destination master machine, the destination master machines corresponding to the child machines in each source master machine can be selected, and then the child machines in the source master machines can be migrated to the destination master machines to achieve secondary allocation management of resources. Specifically, the child machines in each source master machine can be sequentially used as the child machines to be migrated, and according to the resource information of the child machines to be migrated, the physical machines suitable for the child machines to be migrated can be selected from the destination master machines as the corresponding destination master machines to be migrated. In the embodiments of this specification, when selecting the destination master machines to be migrated corresponding to the child machines to be migrated, the idle resources in each destination master machine can be sequentially compared with the resource information of the child machines to be migrated. If the idle resources in the destination master machine are greater than or equal to the resource information of the child machine to be migrated, it means that the idle resources in the destination master machine are sufficient and can accommodate the child machine to be migrated. Among them, the idle resources can be understood as the resources in the physical machine that are not occupied or used. In addition, in the embodiments of this specification, it is also necessary to determine whether the idle resources in the destination master machine are fragmented resources, and the destination master machines with idle resources greater than or equal to the resource information of the child machine to be migrated and belonging to fragmented resources are used as the destination master machines to be migrated corresponding to the child machines to be migrated. Among them, fragmented resources can be understood as relatively small resources that are not convenient to use. The idle resources can be compared with a preset resource amount to determine whether they belong to fragmented resources. For example, if the idle resources are less than a certain resource amount, they are considered to be fragmented resources. For example, if the idle resources are less than 8 cores, they are considered to be fragmented resources. Migrating the child machines to be migrated to the physical machines with fragmented resources can fill the fragmented resources, release the resource space of the source master machine, integrate a relatively large-scale resource space, facilitate subsequent use, and improve resource utilization rate.
[0061] In addition, in some embodiments of this specification, the destination master machines with idle resources greater than or equal to the resource information of the child machine to be migrated and the idle resources belonging to fragmented resources in each destination master machine are used as the destination master machines to be migrated corresponding to the child machine to be migrated, including:
[0062] Sequentially calculate whether the idle resources in each destination master machine are greater than or equal to the resource information of the child machine to be migrated, and screen out the destination master machines with idle resources greater than or equal to the resource information of the child machine to be migrated as the preselected destination master machines;
[0063] Sequentially subtract the resource information of the child machine to be migrated from the idle resources of the preselected destination master machines to obtain the resource difference;
[0064] Compare the resource difference with the second preset resource amount, and use the idle resources with the resource difference less than the second preset resource amount as fragmented resources;
[0065] Use the preselected destination master machines corresponding to the idle resources belonging to fragmented resources as the destination master machines to be migrated corresponding to the child machine to be migrated.
[0066] In a specific implementation process, fragmented resources may also refer to resources that are relatively small and inconvenient to use after migrating the sub-machine to be migrated. Based on this, when determining whether idle resources belong to fragmented resources, the idle resources can also be compared with the resource information of the sub-machine to be migrated. When the idle resources are greater than or equal to the resource information of the sub-machine to be migrated, the closer the idle resources are to the resource information of the sub-machine to be migrated, the smaller the remaining resource space will be after migrating the sub-machine to be migrated, and the remaining resource space is inconvenient to use. Moreover, migrating the sub-machine to be migrated can maximize the resource utilization rate. Such idle resources can be considered as fragmented resources. First, the idle resources in each destination master machine can be compared with the resource information of the sub-machine to be migrated, and the destination master machines with idle resources greater than or equal to the resource information of the sub-machine to be migrated can be selected as the preselected destination master machines. Then, the difference between the idle resources in each preselected destination sub-machine and the resource information of the sub-machine to be migrated is calculated to obtain the corresponding resource difference. Next, the calculated resource difference is compared with the second preset resource amount. If the resource difference is less than the second preset resource amount, it can be shown that the idle resources are relatively close to the resource information in the sub-machine to be migrated, and the remaining resource space is relatively small and inconvenient to use after migrating the sub-machine to be migrated. The idle resources with a resource difference less than the second preset resource amount can be used as fragmented resources. Furthermore, the preselected destination master machine corresponding to the idle resources belonging to fragmented resources can be used as the incoming master machine corresponding to the sub-machine to be migrated, thereby realizing the maximum utilization of resources in the destination master machine, reducing fragmented resources, and improving the resource utilization rate.
[0067] Among them, the specific value of the second preset resource amount can be set according to actual needs. The second preset resource amount can be the same as or different from the first preset resource amount. The embodiments of this specification do not make specific limitations on the value of the second preset resource amount.
[0068] In some embodiments of this specification, if there are two or more preselected destination master machines corresponding to the idle resources belonging to fragmented resources, the method further includes:
[0069] Using the preselected destination master machine corresponding to the idle resources belonging to fragmented resources and having the smallest resource difference as the incoming master machine corresponding to the sub-machine to be migrated.
[0070] In a specific implementation process, the resource difference corresponding to the idle resources in each preselected destination master machine is compared with the second preset resource amount, and the idle resources with a resource difference less than the second preset resource amount are selected as fragmented resources. If, after calculation, there are multiple idle resources less than the second preset resource amount, that is, there may be multiple eligible destination master machines to be migrated, one can be randomly selected as the corresponding destination master machine to be migrated. In some embodiments of this specification, when there are multiple idle resources belonging to fragmented resources, the preselected destination master machine corresponding to the idle resource with the smallest resource difference can be used as the destination master machine to be migrated corresponding to the sub-machine to be migrated, so that the idle resources of the destination master machine to be migrated are closest to the resources of the sub-machine to be migrated, and the resource utilization rate can be maximally improved.
[0071] For example: The resource information of the sub-machine A to be migrated is that the kernel is 8 cores. The idle resources of each destination master machine are compared with the resource information of the sub-machine A to be migrated, and the destination master machines a, c, and f with idle resources greater than 8 cores are selected as preselected destination master machines. Then, the idle resources of the preselected destination master machines a, c, and f are subtracted from the 8 cores of the resource information of the sub-machine A to be migrated, and the resource differences corresponding to the idle resources of the preselected destination master machines a, c, and f are obtained as 2, 3, and 8 respectively. The calculated resource differences are compared with the second preset resource amount. Assuming that the second preset resource amount is 4 cores, it is determined that the resource differences corresponding to the idle resources of the preselected destination master machines a and c are less than the second preset resource amount, and the idle resources of the preselected destination master machines a and c can be used as fragmented resources. At this time, the resource differences corresponding to the idle resources of the preselected destination master machines a and c can be compared. The smaller the resource difference, the closer it is to the resource information of the sub-machine A to be migrated. The preselected destination master machine a corresponding to the idle resource with the smallest resource difference can be used as the destination master machine to be migrated corresponding to the sub-machine A to be migrated.
[0072] In the embodiments of this specification, the idle resources of each destination master machine can be compared with the resource information of the sub-machine to be migrated, and the preselected destination master machines with idle resources greater than or equal to the resource information of the sub-machine to be migrated are selected to ensure that there is sufficient resource space after the sub-machine to be migrated is migrated. At the same time, the idle resources of the preselected destination master machine can also be subtracted from the resource information of the sub-machine to be migrated to obtain a resource difference. The resource difference is compared with the second preset resource amount, and the idle resources relatively close to the resource information of the sub-machine to be migrated are selected as fragmented resources. In the case where there are multiple idle resources belonging to fragmented resources, the preselected destination master machine corresponding to the idle resource with the smallest resource difference is selected as the destination master machine to be migrated, so that after the sub-machine to be migrated is migrated, the fragmented resources in the destination master machine to be migrated are reduced as little as possible, and the resource utilization rate is maximally improved.
[0073] In some embodiments of the present specification, the idle resources in each destination-end mother machine are greater than or equal to the resource information of the child machine to be migrated, and the idle resources belong to the fragmented resources of the destination-end mother machine as the mother machine to be migrated corresponding to the child machine to be migrated, including:
[0074] Calculate in sequence whether the idle resources in each destination host are greater than or equal to the resource information of the child host to be migrated, and select the destination host whose idle resources are greater than or equal to the resource information of the child host to be migrated as the candidate destination host;
[0075] The idle resources in the candidate destination host machine are calculated as a remainder with the third preset resource amount to obtain a resource remainder result. If the resource remainder result is greater than or equal to the resource information of the to-be-migrated child machine, it is determined that the idle resources are fragmented resources.
[0076] The candidate destination end master machine corresponding to the idle resources belonging to the fragmented resources is used as the to-be-migrated master machine corresponding to the to-be-migrated slave machine.
[0077] In the specific implementation process, when determining whether idle resources belong to fragmented resources, the idle resources screened out are not only those with relatively small resource spaces, but also whether the idle resources themselves contain a relatively large resource that can be used directly. Specifically, the idle resources in each destination mother machine can be compared with the resource information of the child machine to be migrated, and the destination mother machine whose idle resources are greater than or equal to the resource information of the child machine to be migrated is screened out as a candidate destination mother machine. Then, the idle resources in each candidate destination sub-machine are calculated with the third preset resource amount to obtain the resource remainder result. If the resource remainder result is greater than or equal to the resource information of the child machine to be migrated, it can be considered that the idle resources belong to fragmented resources. Among them, the value of the third preset resource amount can be set according to actual needs. Generally, the value of the third preset resource amount can be a more commonly used resource amount such as: the core is 16 cores. The embodiment of this specification does not specifically limit the value of the third preset resource amount. After taking the more commonly used resource amount as the third preset resource amount according to actual needs, the idle resources in each candidate destination terminal machine are calculated with the third preset resource amount as a remainder, and the calculated resource remainder result is compared with the resource information of the sub-machine to be migrated, and the idle resources whose resource remainder result is greater than or equal to that of the sub-machine to be migrated are screened out. This not only ensures that the screened idle resources have enough space to meet the needs of the sub-machine to be migrated, but also does not destroy the originally relatively complete and relatively large-scale resources in the idle resources (i.e., the third preset resource amount), and retains the resource space corresponding to the third preset resource amount as much as possible. The resource space can be used alone, so that in the process of filling up fragmented resources, the generation of new fragmented resources can be minimized.
[0078] For example: The resource information of the sub-machine A to be migrated is that the kernel has 4 cores. Compare the idle resources of each destination master machine with the resource information of the sub-machine A to be migrated, and filter out the destination master machines a and c with idle resources greater than 4 cores as candidate destination master machines. Perform a modulo operation on the idle resources of the candidate destination master machines a and c with the third preset resource amount. Assume that the third preset resource amount is 16 cores, and the idle resources of the candidate destination master machines a and c are 8 and 33 respectively. Among them, 8 % 16 = 8, 33 % 16 = 1. It can be seen that the resource remainder result corresponding to the idle resources of the candidate destination master machine a is 8, and the resource remainder result corresponding to the idle resources of the candidate destination master machine c is 1. Among them, the resource remainder result corresponding to the idle resources of the candidate destination master machine a is greater than the resource information 4 of the sub-machine A to be migrated, so the idle resources of the candidate destination master machine a can be used as fragmented resources. Among them, the idle resource 33 of the candidate destination master machine c can be directly used by 2 services that need to occupy 16 cores or one 32-core service, and does not belong to fragmented resources.
[0079] After determining the idle resources belonging to fragmented resources, the candidate destination master machine corresponding to the idle resources belonging to fragmented resources can be used as the destination master machine to which the sub-machine to be migrated corresponds. For example: In the above example, the candidate destination master machine a can be used as the destination master machine to which the sub-machine A to be migrated corresponds. In this way, after migrating the sub-machine A to be migrated to the destination master machine a, the idle resources in the destination master machine a become 4, reducing the fragmented resources of the destination master machine a and improving the resource utilization rate of the destination master machine a.
[0080] In some embodiments of this specification, if the candidate destination master machines corresponding to the idle resources belonging to fragmented resources are greater than or equal to two, the method further includes:
[0081] Using the candidate destination master machine corresponding to the idle resource with the smallest resource remainder result as the destination master machine to which the sub-machine to be migrated corresponds.
[0082] In the specific implementation process, compare the resource remainder results corresponding to the idle resources in each candidate destination master machine with the resource information of the sub-machine to be migrated, and filter out the idle resources with resource remainder results greater than the resource information of the sub-machine to be migrated as fragmented resources. If after calculation, there are multiple idle resources belonging to fragmented resources, that is, there may be multiple eligible destination master machines, one can be randomly selected as the corresponding destination master machine. In some embodiments of this specification, when there are multiple idle resources belonging to fragmented resources, the candidate destination master machine corresponding to the idle resource with the smallest resource remainder result can be used as the destination master machine to which the sub-machine to be migrated corresponds. In this way, it can be ensured that the idle resources of the destination master machine can be closest to the resources of the sub-machine to be migrated while retaining a relatively complete resource space, and the resource utilization rate can be maximally improved.
[0083] For example: The resource information of the sub-machine A to be migrated is that the kernel has 4 cores. Compare the idle resources of each destination master machine with the resource information of the sub-machine A to be migrated, and select the destination master machines a, c, and f with idle resources greater than 4 cores as candidate destination master machines. Perform a modulo operation on the idle resources of the candidate destination master machines a, c, and f with a third preset resource amount. Assume that the third preset resource amount is 16 cores, and the idle resources of the candidate destination master machines a, c, and f are 8, 33, and 22 respectively. Among them, 8 % 16 = 8, 33 % 16 = 1, 22 % 16 = 6. It can be seen that the resource remainder results corresponding to the idle resources of the candidate destination master machines a, c, and f are 8, 1, and 6. Among them, the resource remainder results corresponding to the idle resources of the candidate destination master machines a and f are greater than the resource information 4 of the sub-machine A to be migrated. Then, the idle resources of the candidate destination master machines a and f can be used as fragmented resources. Among them, the resource remainder result 6 corresponding to the idle resources of the candidate destination master machine f is the smallest. That is to say, after reserving the resource space corresponding to the multiple of the third preset resource amount for the idle resources of the candidate destination master machine f, the remaining resource space can not only meet the resource requirements of the sub-machine A to be migrated, but also be closest to the resource amount of the sub-machine A to be migrated, and can minimize the fragmented resources brought after the sub-machine migration. Then, the candidate destination master machine f can be used as the destination master machine corresponding to the sub-machine A to be migrated.
[0084] In the embodiments of this specification, the idle resources in the candidate destination master machines greater than or equal to the resource information of the sub-machine to be migrated can be modulo-calculated with the third preset resource amount, and the idle resources with resource remainder results greater than or equal to the resource information of the sub-machine to be migrated are selected as fragmented resources, so that the relatively commonly used and relatively large-scale resource spaces can be retained as much as possible in the candidate destination master machines, and the remaining resource space can meet the requirements of the sub-machine to be migrated. When there are multiple idle resources with resource remainder results greater than or equal to the resource information of the sub-machine to be migrated, the candidate destination master machine corresponding to the idle resource with the smallest resource remainder result is selected as the destination master machine to be migrated, so that the destination master machine to be migrated can be closest to the resources of the sub-machine to be migrated on the premise of retaining a relatively complete resource space, and the resource utilization rate can be improved to the greatest extent.
[0085] S208: Hot migrate each sub-machine to be migrated in each source master machine to the corresponding destination master machine to be migrated.
[0086] In a specific implementation process, after obtaining the target host corresponding to each virtual machine to be migrated in each source host based on the resource information of each virtual machine corresponding to each slave machine in the source host and the idle resources of each target host, the hot migration method can be used to migrate each virtual machine to be migrated to the corresponding target host. After the migration is completed, a virtual machine will be added to the target host. Among them, hot migration, also known as dynamic migration and live migration, that is, virtual machine save / restore, usually saves the entire running state of the virtual machine completely, and can be quickly restored to the original hardware platform or even a different hardware platform. After the restoration, the virtual machine still runs smoothly, and users will not notice any differences. Hot migration is performed during the system operation. The virtual machines in each source host are migrated to the corresponding target host through hot migration. The migration process does not affect the system operation, and realizes the reasonable scheduling and management of the resources of each physical machine, improving the resource utilization rate.
[0087] The resource management method provided by the embodiments of this specification can divide the physical machines to which the virtual machines can be migrated into source hosts based on the load information and resource information of the virtual machines in each physical machine, and divide the physical machines to which the virtual machines cannot be migrated into target hosts. Then, based on the resource information of each virtual machine in the source host, select the physical machines with sufficient resource space and fragmented resources in the target host as the target hosts corresponding to the virtual machines to be migrated, and then migrate the virtual machines to be migrated in the source host to the corresponding target hosts through hot migration technology. By migrating the virtual machines in the source host to the target hosts with sufficient resource space and fragmented resources through hot migration technology, the secondary scheduling management of the resources in each physical machine is realized. It can not only fill the fragmented resources in the target host, reduce the fragmented resources in the physical machine, but also release the resources in the source host, integrate large-scale resource space for subsequent use, improve the resource utilization rate, and reduce the cost of resource management.
[0088] In some embodiments of this specification, each virtual machine in each source host is sequentially used as the virtual machine to be migrated. According to the resource information of the virtual machine to be migrated, the target hosts whose idle resources are greater than or equal to the resource information of the virtual machine to be migrated and whose idle resources belong to fragmented resources in each target host are used as the target hosts corresponding to the virtual machine to be migrated, including:
[0089] Add each virtual machine in the source host to the resource management scheduling queue, and add each target host to the resource management target host queue;
[0090] Determine whether the idle resources in the mother machine to be matched are greater than or equal to the resource information of the child machine to be migrated and belong to fragmented resources. If so, use the mother machine to be matched as the mother machine to be migrated into. If not, select the next destination mother machine from the resource management migrated mother machine queue as the new mother machine to be matched, and determine whether the idle resources of the new mother machine to be matched are greater than or equal to the resource information of the child machine to be migrated and belong to fragmented resources, until the mother machine to be migrated corresponding to the child machine to be migrated is selected or all the destination mother machines in the resource management migrated mother machine queue have been calculated;
[0091] Update the resource information of the mother machine to be migrated in the resource management migrated mother machine queue, select the next child machine from the resource management scheduling queue as the new child machine to be migrated, and determine the mother machine to be migrated corresponding to the new child machine to be migrated from the updated resource management migrated mother machine queue, until all the child machines in the resource management scheduling queue have been calculated.
[0092] In a specific implementation process, after screening out the source mother machine and the destination mother machine, each child machine in each source mother machine can be sequentially added to the resource management scheduling queue, and the destination mother machine can be sequentially added to the resource management migrated mother machine queue, and a suitable mother machine to be migrated can be selected for each child machine according to the resource management scheduling queue and the resource management migrated mother machine queue.
[0093] Specifically, Figure 4 is a schematic diagram of the selection process of the mother machine that can be migrated in an embodiment of this specification, as Figure 4As shown in the figure, a sub-machine can be selected from the resource management and scheduling queue as the sub-machine to be migrated according to the arrangement order of each sub-machine in the queue. At the same time, a target mother machine can be selected from the resource management and incoming mother machine queue as the mother machine to be matched according to the order of each target mother machine in the queue. Based on the resource information of the sub-machine to be migrated and the idle resources of the mother machine to be matched, it is judged whether the idle resources of the mother machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated, that is, whether the idle resources of the mother machine to be matched are sufficient, and whether the idle resources belong to fragmented resources. If both conditions are met, the mother machine to be matched is used as the incoming mother machine corresponding to the sub-machine to be migrated. If the idle resources of the mother machine to be matched are less than the resource information of the sub-machine to be migrated, or the idle resources of the mother machine to be matched do not belong to fragmented resources, then the mother machine to be matched does not meet the requirements of the incoming mother machine of the sub-machine to be migrated. The mother machine to be matched can be temporarily removed from the current resource management and incoming mother machine queue, and the next target mother machine is selected from the resource management and incoming mother machine queue as the new mother machine to be matched, and it is judged whether the idle resources of the new mother machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated, and whether the idle resources of the new mother machine to be matched belong to fragmented resources. If both conditions are met, the new mother machine to be matched can be used as the incoming mother machine of the sub-machine to be migrated. If at least one condition is not met, the above steps are repeated, the new mother machine to be matched is temporarily removed from the current resource management and incoming mother machine queue, and the next target mother machine is selected from the resource management and incoming mother machine queue, and the above process is repeated until an incoming mother machine suitable for the sub-machine to be migrated is found, or all the target mother machines in the resource management and incoming mother machine queue have been calculated and do not meet the requirements of the incoming mother machine of the sub-machine to be migrated, that is, the resource management and incoming mother machine queue is empty. Then the sub-machine to be migrated can be temporarily not migrated and processed later. Among them, the judgment method of whether the idle resources belong to fragmented resources can refer to the description of the above embodiment and will not be elaborated here.
[0094] Through the bin-packing algorithm, select a physical machine among other physical machines whose remaining resources can meet the migration specifications this time and contain fragmented resources, and mark it as the incoming mother machine, and prepare to initiate the migration operation.
[0095] Each destination master machine may serve as the master machine to which one or more slave machines are to be migrated. Therefore, after selecting the master machine suitable for the slave machine to be migrated from the resource management incoming master machine queue, the resource information of the master machine to be migrated in the resource management incoming master machine queue can be updated. For example, the free resources of the master machine to be migrated can be subtracted by the resource information of the slave machine to be migrated to obtain the new resource information of the master machine to be migrated. Then, select the next slave machine from the resource management scheduling queue as the new slave machine to be migrated, and according to the above method, obtain the updated resource management incoming master machine queue, and select, from the destination master machines in the updated resource management incoming master machine queue, the destination master machine whose free resources are greater than or equal to the resource information of the new slave machine to be migrated and whose free resources belong to fragmented resources as the corresponding master machine to be migrated, and update the resource information of the master machine to be migrated in the resource management incoming master machine queue. And so on, select the next slave machine from the resource management scheduling queue as the new slave machine to be migrated, and according to the same method, select a suitable master machine to be migrated from the destination master machines in the updated resource management incoming master machine queue until all the slave machines in the resource management scheduling queue have been calculated, and obtain the master machine to be migrated corresponding to each slave machine. Then, use the live migration technology to migrate each slave machine to be migrated, and the secondary scheduling management of the resources in each physical machine can be realized.
[0096] In the embodiments of the present specification, each slave machine in the source master machine can be added to the resource management scheduling queue. At the same time, each destination master machine is added to the resource management incoming master machine queue in sequence. According to the arrangement order in the resource management scheduling queue and the resource management incoming master machine queue, each slave machine is used as the slave machine to be migrated in turn, and the corresponding master machine to be migrated is selected from each destination master machine to ensure that a suitable master machine to be migrated is selected for each slave machine, and to realize the migration of the slave machines with small cores and low loads to the physical machines with fragmented resources, filling the fragmented resources in the physical machines and improving the resource utilization rate.
[0097] In some embodiments of the present specification, migrating each slave machine to be migrated in the source master machine to the corresponding master machine to be migrated includes:
[0098] Mount the cloud disks of each slave machine to be migrated in the source master machine and the master machine to be migrated;
[0099] Use live migration to migrate the data in the memory of the slave machine to be migrated to the corresponding master machine to be migrated of the slave machine to be migrated;
[0100] After the memory migration of the slave machine to be migrated is completed, pause the slave machine to be migrated in the source master machine, and start the slave machine to be migrated in the destination master machine. After successful startup, destroy the slave machine to be migrated in the source master machine.
[0101] In the specific implementation process, Figure 5It is a schematic flowchart of thermal migration in an embodiment of this specification. After determining the target parent machine corresponding to the child machine to be migrated in the source parent machine, for example Figure 5 As shown in the thermal migration process, the child machine to be migrated can be migrated to the corresponding target parent machine. Specifically, as Figure 5 shown, when performing thermal migration, first, the cloud disk of the child machine to be migrated can be double-mounted, that is, the cloud disk of the child machine to be migrated is mounted on the source parent machine and the target parent machine, and the virtual machine memory iterative copy transmission is enabled to migrate the data in the memory of the child machine to be migrated to the corresponding target parent machine. As Figure 5 shown, the thermal migration technology is adopted in the embodiments of this specification. During the migration process, the child machine to be migrated is still running, so the data in the memory may change. Through iterative transmission, the changed data is continuously transmitted to the target parent machine to ensure the accuracy and integrity of data transmission. After the memory copy is completed, the child machine to be migrated in the source parent machine is paused, and the child machine to be migrated is started in the target parent machine. After the child machine to be migrated is successfully started, the child machine to be migrated in the source parent machine is destroyed, and the resources in the source parent machine are released.
[0102] Among them, thermal migration can perform thermal migration operations on the child machine to be migrated immediately after determining the target parent machine corresponding to each child machine to be migrated, or can perform thermal migration operations in batches after determining the target parent machines corresponding to all or a certain number of child machines to be migrated. Specifically, it can be set according to the actual situation, and the embodiments of this specification do not make specific limitations.
[0103] In the embodiments of this specification, the thermal migration technology is used to migrate the migratable child machines to the physical machines with fragmented resources, which can not only fill the fragmented resources in the physical machines, but also release the resource space of the source parent machine, integrate a relatively large-scale resource space for unified allocation and use, and improve the resource utilization rate. Moreover, the thermal migration process does not affect the operation of the system. At the same time, during the thermal migration process, the cloud disk of the child machine is double-mounted, and when performing thermal migration, there is no need to separately copy and transfer the data of the cloud disk. The cloud disk data can be migrated directly by mounting, which improves the speed of data migration.
[0104] In addition, in some embodiments, the resources in each physical machine may change continuously. The physical machines in the system can be managed for resources once every certain period of time to fill the fragmented resources and integrate a large-scale resource space, thereby improving the resource utilization rate in the system.
[0105] Figure 6 It is a schematic diagram of the principle structure of a resource management system in an embodiment of this specification. As Figure 6 shown, in some embodiments of this specification, a resource management system can also be provided. The system includes: a resource selector and a resource scheduler, where:
[0106] The resource selector is used to obtain the load information and resource information of the child machines in each physical machine. According to the load information and resource information of the child machines in each physical machine, the physical machines to which the child machines can be migrated are selected as the source parent machines, and the physical machines to which the child machines cannot be migrated are used as the destination parent machines;
[0107] The resource scheduler is used to sequentially use the child machines in each source parent machine as the child machines to be migrated. According to the resource information of the child machines to be migrated, the destination parent machines whose free resources are greater than or equal to the resource information of the child machines to be migrated and whose free resources belong to fragmented resources are used as the destination parent machines corresponding to the child machines to be migrated, and each child machine to be migrated in each source parent machine is hot migrated to the corresponding destination parent machine.
[0108] In the specific implementation process, as Figure 6 shown, the resource management system may include a resource selector. The resource selector may divide the physical machines in the physical machine cluster into source parent machines and destination parent machines. The specific division method may refer to the description of the above embodiments and will not be elaborated here. In addition, the resource selector may put the child machines in the source parent machines into the resource management scheduling queue, put the destination parent machines into the resource management incoming parent machine queue, and then select a suitable destination parent machine for each child machine to be migrated in the resource management scheduling queue from the resource management incoming parent machine queue. Finally, the child machines are migrated to the corresponding destination parent machines through hot migration. As Figure 6 shown, when the child machines in the source parent machines are migrated to the destination parent machines, the resources occupied by the child machines in the source parent machines will be released, and a child machine will be added to the destination parent machines. After the source parent machines release the resources, they are completely idle and can sell large-scale resources in the live network or be used for operations such as relocation, realizing the secondary integration management of resources and improving the resource utilization rate.
[0109] Among them, the selection method of the destination parent machine corresponding to the child machine to be migrated and the specific process of hot migration may refer to the description of the above embodiments and will not be elaborated here.
[0110] The resource management method provided by the embodiments of this specification improves the resource selling rate of the entire live network through the hot migration and relocation of virtual machines. After verification, the selling rate can be increased to 100%. 1500 physical machines can be emptied through migration and integration every day, and the resources are reused through means such as reselling, data center downsizing, equipment power-off, and relocation and reuse, greatly saving the operating cost of resource management.
[0111] Based on the above-described resource management method, one or more embodiments of this specification further provide a terminal and a server for resource management processing. The terminal and the server may include devices (including distributed systems), software (applications), modules, components, servers, terminals, etc. that use the method described in the embodiments of this specification and are combined with the necessary implementation hardware. Based on the same innovative concept, the devices in one or more embodiments provided by the embodiments of this specification are as described in the following embodiments. Since the implementation solutions for the devices to solve problems are similar to the method, the implementation of the specific devices in the embodiments of this specification can refer to the implementation of the foregoing method, and the repeated parts will not be elaborated. As used hereinafter, the term "unit" or "module" may be a combination of software and / or hardware that can implement a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0112] As can be seen from the technical solutions provided by the embodiments of this specification above, the embodiments of this specification also provide a resource management device. Figure 7 It is a schematic structural diagram of a resource management device provided by the embodiments of this specification, as Figure 7 shown, the above device includes:
[0113] A sub-machine information acquisition module 710, configured to acquire the load information and resource information of the sub-machines in each physical machine;
[0114] A master machine division module 720, configured to screen out the physical machines to which the sub-machines can be migrated as the source-end master machines according to the load information and resource information of the sub-machines in each physical machine, and use the physical machines to which the sub-machines cannot be migrated as the destination-end master machines;
[0115] A resource scheduling module 730, configured to sequentially use the sub-machines in each of the source-end master machines as the sub-machines to be migrated, and according to the resource information of the sub-machines to be migrated, use the destination-end master machines whose idle resources are greater than or equal to the resource information of the sub-machines to be migrated and the idle resources belong to fragmented resources as the destination-end master machines corresponding to the sub-machines to be migrated;
[0116] A resource migration module 740, configured to hot-migrate each of the sub-machines to be migrated in each of the source-end master machines to the corresponding destination-end master machines.
[0117] In some embodiments, the master machine division module 720 is specifically configured to:
[0118] According to the load information and resource information of the sub-machines in each physical machine, use the sub-machines with load information less than the preset load and resource information less than the first preset resource amount as the migratable sub-machines;
[0119] Take the physical machine in which all sub-machines are migratable sub-machines as the source master machine;
[0120] Take the physical machine in which at least one sub-machine is non-migratable as the destination master machine.
[0121] In some embodiments, the resource scheduling module 730 is specifically configured to:
[0122] Calculate in sequence whether the idle resources in each of the destination master machines are greater than or equal to the resource information of the sub-machine to be migrated, and screen out the destination master machines whose idle resources are greater than or equal to the resource information of the sub-machine to be migrated as the preselected destination master machines;
[0123] Subtract the resource information of the sub-machine to be migrated from the idle resources of the preselected destination master machines in sequence to obtain a resource difference value;
[0124] Compare the resource difference value with a second preset resource amount, and take the idle resources whose resource difference value is less than the second preset resource amount as fragmented resources;
[0125] Take the preselected destination master machine corresponding to the idle resources belonging to the fragmented resources as the incoming master machine corresponding to the sub-machine to be migrated.
[0126] In some embodiments, the resource scheduling module 730 is further configured to:
[0127] If there are two or more preselected destination master machines corresponding to the idle resources belonging to the fragmented resources, take the preselected destination master machine corresponding to the idle resources belonging to the fragmented resources and having the smallest resource difference value as the incoming master machine corresponding to the sub-machine to be migrated.
[0128] In some embodiments, the resource scheduling module 730 is specifically configured to:
[0129] Calculate in sequence whether the idle resources in each of the destination master machines are greater than or equal to the resource information of the sub-machine to be migrated, and screen out the destination master machines whose idle resources are greater than or equal to the resource information of the sub-machine to be migrated as the candidate destination master machines;
[0130] Perform a remainder calculation on the idle resources in the candidate destination master machines with a third preset resource amount to obtain a resource remainder result. If the resource remainder result is greater than or equal to the resource information of the sub-machine to be migrated, determine that the idle resources belong to the fragmented resources;
[0131] Take the candidate destination master machine corresponding to the idle resources belonging to the fragmented resources as the incoming master machine corresponding to the sub-machine to be migrated.
[0132] In some embodiments, the resource scheduling module 730 is further configured to:
[0133] If there are two or more candidate destination master machines corresponding to the idle resources that belong to fragmented resources, use the candidate destination master machine corresponding to the idle resource with the smallest resource remainder result as the master machine to which the sub-machine to be migrated will be moved in.
[0134] In some embodiments, the resource scheduling module 730 is specifically configured to:
[0135] Add each sub-machine in the source master machine to the resource management scheduling queue, and add each destination master machine to the resource management incoming master machine queue;
[0136] Select a sub-machine from the resource management scheduling queue as the sub-machine to be migrated, and select a destination master machine from the resource management incoming master machine queue as the master machine to be matched;
[0137] Determine whether the idle resources in the master machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated and belong to fragmented resources. If so, use the master machine to be matched as the master machine to be moved in. If not, select the next destination master machine from the resource management incoming master machine queue as the new master machine to be matched, and determine whether the idle resources of the new master machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated and belong to fragmented resources, until the master machine to be moved in corresponding to the sub-machine to be migrated is selected or all destination master machines in the resource management incoming master machine queue have been calculated;
[0138] Update the resource information of the master machine to be moved in in the resource management incoming master machine queue, select the next sub-machine from the resource management scheduling queue as the new sub-machine to be migrated, and determine the master machine to be moved in corresponding to the new sub-machine to be migrated from the updated resource management incoming master machine queue, until all sub-machines in the resource management scheduling queue have been calculated.
[0139] In some embodiments, the resource migration module 740 is specifically configured to:
[0140] Mount the cloud disks of each of the sub-machines to be migrated in the source master machine in both the source master machine and the master machine to be moved in;
[0141] Use hot migration to migrate the data in the memory of the sub-machine to be migrated to the master machine to be moved in corresponding to the sub-machine to be migrated;
[0142] After the memory migration of the sub-machine to be migrated is completed, pause the sub-machine to be migrated in the source master machine, and start the sub-machine to be migrated in the destination master machine. After successful startup, destroy the sub-machine to be migrated in the source master machine.
[0143] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here. The device in the above embodiments may also include other implementation manners according to the description of the method embodiments. The specific implementation manners may refer to the description of the relevant method embodiments, and will not be repeated here one by one.
[0144] Figure 8 is a block diagram of an electronic device for resource management provided by an embodiment of this specification. The electronic device may be a terminal, and its internal structure diagram may be as Figure 8 shown. The electronic device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a resource management method is implemented. The display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device may be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the electronic device, or an external keyboard, a touchpad, or a mouse, etc.
[0145] Figure 9 is another block diagram of an electronic device for resource management provided by an embodiment of this specification. The electronic device may be a server, and its internal structure diagram may be as Figure 9 shown. The electronic device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a resource management method is implemented.
[0146] Those skilled in the art can understand that Figure 8 or Figure 9 the structures shown in are only block diagrams of some structures related to the solution of the embodiments of this specification, and do not constitute a limitation on the electronic devices to which the solutions of the embodiments of this specification are applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0147] In an exemplary embodiment, an electronic device is further provided, including: a processor; a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the instructions to implement the resource management method as in the embodiments of this specification.
[0148] In an exemplary embodiment, a computer-readable storage medium is further provided. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the resource management method in the embodiments of this specification.
[0149] In an exemplary embodiment, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the resource management method provided in the above various optional implementation manners.
[0150] It can be understood that in the specific implementation manners of this specification, when it comes to user-related data, when the above embodiments of this specification are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions.
[0151] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in this specification can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0152] Other embodiments of the embodiments of this specification will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the embodiments of this specification, which follow the general principles of the embodiments of this specification and include known common knowledge or conventional technical means in the technical field not disclosed in the embodiments of this specification. The specification and the embodiments are only regarded as exemplary, and the true scope and spirit of the embodiments of this specification are pointed out by the following claims.
[0153] It should be understood that the embodiments of this specification are not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the embodiments of this specification is only limited by the appended claims.
Claims
1. A resource management method, characterized in that, The method includes: Obtaining the load information and resource information of the sub - machines in each physical machine; According to the load information and resource information of the sub - machines in each physical machine, screening out the physical machines to which the sub - machines can be migrated as the source - end master machines, and taking the physical machines to which the sub - machines cannot be migrated as the destination - end master machines; Successively taking the sub - machines in each of the source - end master machines as the sub - machines to be migrated, and according to the resource information of the sub - machines to be migrated, taking the destination - end master machines whose free resources are greater than or equal to the resource information of the sub - machines to be migrated and whose free resources belong to fragmented resources as the destination - end master machines corresponding to the sub - machines to be migrated; Thermally migrating each of the sub - machines to be migrated in each of the source - end master machines to the corresponding destination - end master machines.
2. The method according to claim 1, wherein The step of screening out the physical machines to which the sub - machines can be migrated as the source - end master machines and taking the physical machines to which the sub - machines cannot be migrated as the destination - end master machines according to the load information and resource information of the sub - machines in each physical machine includes: According to the load information and resource information of the sub - machines in each physical machine, taking the sub - machines whose load information is less than the preset load and whose resource information is less than the first preset resource amount as the migratable sub - machines; Taking the physical machines in which all sub - machines are migratable sub - machines as the source - end master machines; Taking the physical machines in which there is at least one non - migratable sub - machine as the destination - end master machines.
3. The method according to claim 1, wherein The step of taking the destination - end master machines whose free resources are greater than or equal to the resource information of the sub - machines to be migrated and whose free resources belong to fragmented resources as the destination - end master machines corresponding to the sub - machines to be migrated includes: Successively calculating whether the free resources in each of the destination - end master machines are greater than or equal to the resource information of the sub - machines to be migrated, and screening out the destination - end master machines whose free resources are greater than or equal to the resource information of the sub - machines to be migrated as the pre - selected destination - end master machines; Successively subtracting the resource information of the sub - machines to be migrated from the free resources of the pre - selected destination - end master machines to obtain the resource difference; Comparing the resource difference with the second preset resource amount, and taking the free resources with the resource difference less than the second preset resource amount as the fragmented resources; Taking the pre - selected destination - end master machines corresponding to the free resources belonging to the fragmented resources as the destination - end master machines corresponding to the sub - machines to be migrated.
4. The method according to claim 3, characterized in that If there are two or more pre - selected destination - end master machines corresponding to the free resources belonging to the fragmented resources, the method further includes: Taking the pre - selected destination - end master machine corresponding to the free resources belonging to the fragmented resources and having the smallest resource difference as the destination - end master machine corresponding to the sub - machines to be migrated.
5. The method according to claim 1, characterized in that, The step of taking the destination - end master machines whose free resources are greater than or equal to the resource information of the sub - machines to be migrated and whose free resources belong to fragmented resources as the destination - end master machines corresponding to the sub - machines to be migrated includes: Successively calculating whether the free resources in each of the destination - end master machines are greater than or equal to the resource information of the sub - machines to be migrated, and screening out the destination - end master machines whose free resources are greater than or equal to the resource information of the sub - machines to be migrated as the candidate destination - end master machines; Perform a modulo operation on the idle resources in the candidate destination master machine and the third preset resource amount to obtain a resource remainder result. If the resource remainder result is greater than or equal to the resource information of the sub-machine to be migrated, determine that the idle resources belong to fragmented resources; Use the candidate destination master machine corresponding to the idle resources belonging to fragmented resources as the incoming master machine corresponding to the sub-machine to be migrated.
6. The method according to claim 5, wherein If there are two or more candidate destination master machines corresponding to the idle resources belonging to fragmented resources, the method further includes: Use the candidate destination master machine corresponding to the idle resources with the smallest resource remainder result as the incoming master machine corresponding to the sub-machine to be migrated.
7. The method according to claim 1, characterized in that The step of sequentially using the sub-machines in each source master machine as the sub-machines to be migrated, and according to the resource information of the sub-machines to be migrated, using the destination master machines in which the idle resources are greater than or equal to the resource information of the sub-machines to be migrated and the idle resources belong to fragmented resources as the incoming master machines corresponding to the sub-machines to be migrated includes: Add each sub-machine in the source master machine to the resource management scheduling queue, and add each destination master machine to the resource management incoming master machine queue; Select a sub-machine from the resource management scheduling queue as the sub-machine to be migrated, and select a destination master machine from the resource management incoming master machine queue as the master machine to be matched; Determine whether the idle resources in the master machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated and belong to fragmented resources. If so, use the master machine to be matched as the incoming master machine. If not, select the next destination master machine from the resource management incoming master machine queue as the new master machine to be matched, and determine whether the idle resources of the new master machine to be matched are greater than or equal to the resource information of the sub-machine to be migrated and belong to fragmented resources, until the incoming master machine corresponding to the sub-machine to be migrated is selected or all destination master machines in the resource management incoming master machine queue have been calculated; Update the resource information of the incoming master machine in the resource management incoming master machine queue, select the next sub-machine from the resource management scheduling queue as the new sub-machine to be migrated, and determine the incoming master machine corresponding to the new sub-machine to be migrated from the updated resource management incoming master machine queue until all sub-machines in the resource management scheduling queue have been calculated.
8. The method according to claim 1, characterized in that, The step of hot migrating each of the sub-machines to be migrated in each source master machine to the corresponding incoming master machine includes: Mount the cloud disks of each of the sub-machines to be migrated in the source master machine and the incoming master machine; Use hot migration to migrate the data in the memory of the sub-machine to be migrated to the incoming master machine corresponding to the sub-machine to be migrated; After the memory migration of the sub-machine to be migrated is completed, pause the sub-machine to be migrated in the source master machine, and start the sub-machine to be migrated in the destination master machine. After successful startup, destroy the sub-machine to be migrated in the source master machine.
9. A resource management device, characterized in that, The device includes: A sub-machine information acquisition module, configured to acquire the load information and resource information of the sub-machines in each physical machine; The master machine division module is used to screen out the physical machines to which the sub-machines can be migrated as the source master machines according to the load information and resource information of the sub-machines in each physical machine, and use the physical machines to which the sub-machines cannot be migrated as the destination master machines; The resource scheduling module is used to sequentially use the sub-machines in each of the source master machines as the sub-machines to be migrated, and according to the resource information of the sub-machines to be migrated, use the destination master machines in which the free resources are greater than or equal to the resource information of the sub-machines to be migrated and the free resources belong to fragmented resources as the destination master machines corresponding to the sub-machines to be migrated; The resource migration module is used to hot migrate each of the sub-machines to be migrated in each of the source master machines to the corresponding destination master machines.
10. A resource management system, characterized in that, The system includes: a resource selector and a resource scheduler, where: The resource selector is used to obtain the load information and resource information of the sub-machines in each physical machine, and screen out the physical machines to which the sub-machines can be migrated as the source master machines according to the load information and resource information of the sub-machines in each physical machine, and use the physical machines to which the sub-machines cannot be migrated as the destination master machines; The resource scheduler is used to sequentially use the sub-machines in each of the source master machines as the sub-machines to be migrated, and according to the resource information of the sub-machines to be migrated, use the destination master machines in which the free resources are greater than or equal to the resource information of the sub-machines to be migrated and the free resources belong to fragmented resources as the destination master machines corresponding to the sub-machines to be migrated, and hot migrate each of the sub-machines to be migrated in each of the source master machines to the corresponding destination master machines.
11. An electronic device, characterized in that, It includes: A processor; A memory for storing the executable instructions of the processor; Wherein, the processor is configured to execute the instructions to implement the resource management method according to any one of claims 1-8.
12. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the resource management method according to any one of claims 1-8.
Citation Information
Cited By
Cloud host memory optimization allocation method based on capacity calculation and dynamic migration
CN122111573A
A cloud host memory optimization allocation method based on capacity calculation and dynamic migration
CN122111573B