Resource scheduling method and apparatus, and device, storage medium and program product

WO2026166287A1PCT designated stage Publication Date: 2026-08-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2026-01-09
Publication Date
2026-08-13

Smart Images

  • Figure CN2026071598_13082026_PF_FP_ABST
    Figure CN2026071598_13082026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a resource scheduling method and apparatus, and a computer device, a storage medium and a computer program product. The method comprises: determining a current virtual machine from among a plurality of virtual machines to be created, and using initial physical machine clusters as candidate physical machine clusters corresponding to the current virtual machine; determining, from the candidate physical machine clusters, candidate physical machines for allocation corresponding to the current virtual machine; on the basis of the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine for allocation, and the number of remaining virtual machines, determining reference physical machines for allocation from among the candidate physical machines for allocation; performing idle resource updates on the reference physical machines for allocation in the candidate physical machine clusters, so as to obtain intermediate physical machine clusters corresponding to the current virtual machine; and on the basis of the intermediate physical machine clusters, continuing to allocate the next virtual machine until candidate physical machine clusters and candidate physical machines for allocation that correspond to the last virtual machine are obtained, and then determining a final scheduling scheme. By means of using the present method, the resource utilization rate can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Resource scheduling methods, devices, equipment, storage media, and program products

[0001] Related applications

[0002] This application claims priority to Chinese patent application filed on February 10, 2025, with application number 2025101492355, entitled “Resource scheduling method, apparatus, device, storage medium and program product”, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of computer technology, and in particular to a resource scheduling method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0004] With the development of computer technology, virtualization technology has emerged, which allows one or more virtual machines to be simulated on a single physical machine. Users can apply for virtual machines to replace physical machines and deploy services on them to save costs.

[0005] Currently, when a user needs to request multiple virtual machines, resource scheduling is typically performed using a greedy strategy. This involves creating as many virtual machines as possible on a single physical machine until that machine can no longer create more, then selecting the next physical machine to continue creating the remaining virtual machines, and so on, until all virtual machines have been created. However, using a greedy strategy for resource scheduling has a single perspective and can easily lead to a large amount of resource fragmentation in the physical machine cluster, resulting in low resource utilization. Summary of the Invention

[0006] Therefore, it is necessary to provide a resource scheduling method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the resource utilization of physical machines in response to the above-mentioned technical problems.

[0007] This application provides a resource scheduling method, including:

[0008] Obtain virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to each of the multiple virtual machines to be created;

[0009] The current virtual machine is determined from the plurality of virtual machines, and the initial physical machine cluster is used as the candidate physical machine cluster corresponding to the current virtual machine.

[0010] From the candidate physical machine cluster, determine the candidate physical machine corresponding to the current virtual machine. Based on the idle resource information corresponding to the candidate physical machine and the demand resource information corresponding to the current virtual machine, predict the amount of physical machine cluster fragmentation that will be generated by allocating the current virtual machine to each candidate physical machine.

[0011] Based on the fragmentation amount of the physical machine cluster and the number of remaining virtual machines, the reference allocation physical machine corresponding to the current virtual machine is determined from each candidate allocation physical machine. Based on the resource demand information corresponding to the current virtual machine, the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster is updated respectively to obtain each intermediate physical machine cluster corresponding to the current virtual machine.

[0012] The intermediate physical machine cluster is used as the candidate physical machine cluster corresponding to the next virtual machine, and the next virtual machine is used as the current virtual machine. The step of determining at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster is returned to the execution until the candidate physical machine cluster and each candidate physical machine corresponding to the last virtual machine are obtained.

[0013] Based on the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocation physical machine, each reference physical machine cluster is obtained. From each reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is determined. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

[0014] This application also provides a resource scheduling apparatus, including:

[0015] The requirement information acquisition module is used to acquire virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to each of the multiple virtual machines to be created;

[0016] The virtual machine filtering module is used to determine the current virtual machine from the plurality of virtual machines and to use the initial physical machine cluster as the candidate physical machine cluster corresponding to the current virtual machine.

[0017] The physical machine filtering module is used to determine the candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster, and predict the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine based on the idle resource information corresponding to the candidate physical machine and the demand resource information corresponding to the current virtual machine.

[0018] The physical machine filtering module is further configured to determine the reference allocation physical machine corresponding to the current virtual machine from the candidate allocation physical machines based on the fragmentation amount and the number of remaining virtual machines in the physical machine cluster, and update the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster based on the resource demand information corresponding to the current virtual machine, so as to obtain each intermediate physical machine cluster corresponding to the current virtual machine.

[0019] The virtual machine filtering module is further configured to use the intermediate physical machine cluster as the candidate physical machine cluster corresponding to the next virtual machine, use the next virtual machine as the current virtual machine, and return to the step of determining at least one candidate allocation physical machine corresponding to the current virtual machine from the candidate physical machine cluster, until the candidate physical machine cluster and each candidate allocation physical machine corresponding to the last virtual machine are obtained.

[0020] The scheduling scheme determination module is used to obtain each reference physical machine cluster based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate allocation physical machine, and to determine the final scheduling scheme corresponding to the virtual machine demand information from each reference physical machine cluster. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

[0021] This application also provides a computer device, including a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps described in the resource scheduling method above.

[0022] This application also provides a computer-readable storage medium storing computer-readable instructions thereon, which, when executed by a processor, implement the steps described in the resource scheduling method above.

[0023] This application also provides a computer program product including computer-readable instructions that, when executed by a processor, implement the steps described in the resource scheduling method above.

[0024] The aforementioned resource scheduling method, apparatus, computer equipment, storage medium, and computer program products acquire virtual machine requirement information for an initial physical machine cluster. The virtual machine requirement information includes the resource requirement information corresponding to each of the multiple virtual machines to be created. Based on the virtual machine requirement information, the physical machines corresponding to each virtual machine are determined from the initial physical machine cluster to obtain the final scheduling scheme. Specifically, the current virtual machine is determined from multiple virtual machines. The initial physical machine cluster is used as the candidate physical machine cluster for the current virtual machine. From the candidate physical machine cluster, physical machines capable of accommodating the current virtual machine are selected as candidate allocation physical machines. Based on the idle resource information of the candidate allocation physical machines and the resource demand information of the current virtual machine, the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate allocation physical machine is predicted. Based on the physical machine cluster fragmentation and the number of remaining virtual machines, unsuitable candidate allocation physical machines are further filtered out from each candidate allocation physical machine to obtain the reference allocation physical machine for the current virtual machine. In this way, based on the physical machine cluster fragmentation and the number of remaining virtual machines, scheduling schemes that are not suitable for further allocation of remaining virtual machines can be pre-filtered. This not only effectively improves the resource utilization of physical machines and avoids excessive resource fragmentation and waste caused by the final scheduling scheme, but also effectively reduces the workload of subsequent allocation and improves resource scheduling efficiency. Based on the resource demand information of the current virtual machine, the idle resource information of each reference allocation physical machine in the candidate physical machine cluster is updated to obtain each intermediate physical machine cluster for the current virtual machine. Each intermediate physical machine cluster can indicate various feasible scheduling schemes for the current virtual machine. The intermediate physical machine clusters are used as candidate physical machine clusters for the next virtual machine, and the next virtual machine is used as the current virtual machine. The aforementioned steps are repeated to determine the intermediate physical machine clusters for the next virtual machine, and so on, until the candidate physical machine clusters and candidate allocation physical machines for the last virtual machine (i.e., the last virtual machine) are obtained. Based on the candidate allocation physical machines and candidate physical machine clusters for the last virtual machine, the reference physical machine clusters are obtained. In this way, the next virtual machine is allocated based on the various feasible scheduling schemes of the current virtual machine, which can determine multiple feasible scheduling schemes from multiple perspectives. This helps to improve the resource utilization of physical machines. Furthermore, the various feasible scheduling schemes for the last virtual machine naturally include the allocation methods of the previous virtual machines. Therefore, the final scheduling scheme can be determined through the various feasible scheduling schemes of the last virtual machine.In summary, during resource scheduling, the allocation method for each virtual machine is determined sequentially, and the feasible allocation method for the next virtual machine is determined based on the feasible allocation methods of the current virtual machine, thus achieving dynamic allocation and ensuring the resource utilization of the final allocation method. Furthermore, when determining the feasible allocation method for a single virtual machine, allocation methods that are not suitable for continuing to allocate the remaining virtual machines are filtered out in advance, which can further improve resource utilization and resource scheduling efficiency. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.

[0026] Figure 1 is an application environment diagram of a resource scheduling method in one embodiment;

[0027] Figure 2 is a flowchart illustrating a resource scheduling method in one embodiment;

[0028] Figure 3 is a schematic diagram of resource scheduling in one embodiment;

[0029] Figure 4 is a schematic diagram of predicting the amount of fragmentation in a physical machine cluster in one embodiment;

[0030] Figure 5 is a schematic diagram illustrating the determination of the maximum virtual machine creation specification limit in one embodiment;

[0031] Figure 6 is a schematic diagram of the resource scheduling process in another embodiment;

[0032] Figure 7 is a schematic diagram of the scheduling device receiving and processing requests in one embodiment;

[0033] Figure 8 is a schematic diagram of a dynamic programming algorithm in one embodiment;

[0034] Figure 9 is a schematic diagram of the optimization strategy of the dynamic programming algorithm in one embodiment;

[0035] Figure 10 is a schematic diagram of the resource scheduling process in one embodiment;

[0036] Figure 11 is a schematic diagram comparing the fragmentation rate generated by resource scheduling using the method of this application and the conventional method in one embodiment;

[0037] Figure 12 is a structural block diagram of a resource scheduling device in one embodiment;

[0038] Figure 13 is an internal structure diagram of a computer device in one embodiment;

[0039] Figure 14 is an internal structural diagram of a computer device in another embodiment. Detailed Implementation

[0040] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0041] The terms "comprising" and "having," and any variations thereof, as used in this application, are intended to cover non-exclusive inclusion. The term "multiple" as used in this application refers to two or more. The term "and / or" as used in this application refers to one of the embodiments, or any combination of multiple embodiments.

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

[0043] The resource scheduling method provided in this application embodiment can be applied to the application environment shown in Figure 1. The terminal 102 communicates with the scheduling device 104 via a network, and the scheduling device 104 communicates with the physical machine cluster 106 via a network. It can be understood that the scheduling device 104 can be a terminal or a server. The physical machine cluster 106 includes multiple physical machines, which are actual, physically existing computer devices. Correspondingly, virtual machines are virtualized computer devices, specifically created on physical machines using virtualization technology. The computer devices can be terminals or servers.

[0044] The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, and projection devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0045] Specifically, the initial physical machine cluster refers to the initial physical machine cluster 106. Users can send virtual machine request information for the initial physical machine cluster to the scheduling device 104 via terminal 102, requesting the scheduling device 104 to create multiple virtual machines on the initial physical machine cluster. The scheduling device 104 responds to the request from terminal 102 by performing resource scheduling and obtaining the final scheduling scheme corresponding to the virtual machine request information. The scheduling device 104 issues virtual machine creation tasks to the corresponding physical machines in the initial physical machine cluster according to the final scheduling scheme. The physical machines return creation results to the scheduling device 104, and the scheduling device 104 returns creation results to terminal 102.

[0046] The virtual machine requirement information includes the resource requirements of each of the multiple virtual machines to be created. The scheduling device 104 determines the current virtual machine from among the multiple virtual machines and uses the initial physical machine cluster as the candidate physical machine cluster for the current virtual machine. The scheduling device 104 determines the candidate allocation physical machine for the current virtual machine from the candidate physical machine cluster. Based on the idle resource information of the candidate allocation physical machine and the resource requirement information of the current virtual machine, it predicts the amount of physical machine cluster fragmentation that would result from allocating the current virtual machine to each candidate allocation physical machine. Based on the physical machine cluster fragmentation and the remaining number of virtual machines, the scheduling device 104 determines the reference allocation physical machine for the current virtual machine from among the candidate allocation physical machines. Based on the resource requirement information of the current virtual machine, it updates the idle resource information of each reference allocation physical machine in the candidate physical machine cluster, obtaining each intermediate physical machine cluster corresponding to the current virtual machine. The scheduling device 104 uses the intermediate physical machine cluster as the candidate physical machine cluster for the next virtual machine, uses the next virtual machine as the current virtual machine, and returns to the step of determining at least one candidate allocation physical machine for the current virtual machine from the candidate physical machine cluster until the candidate physical machine cluster and each candidate allocation physical machine for the last virtual machine are obtained. The scheduling device 104 obtains reference physical machine clusters based on the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocation physical machine. From each reference physical machine cluster, it determines the final scheduling scheme corresponding to the virtual machine demand information. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

[0047] In one embodiment, as shown in Figure 2, a resource scheduling method is provided. Taking the application of this method to the scheduling device in Figure 1 as an example, the method includes the following steps:

[0048] Step S202: Obtain virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to the multiple virtual machines to be created.

[0049] A physical machine cluster comprises multiple physical machines, and one or more virtual machines (VMs) can be created on a single physical machine using the physical resources on those machines. The initial physical machine cluster refers to the initial physical machine cluster, i.e., the cluster on which multiple VMs need to be created. VM requirement information for the initial physical machine cluster indicates the creation requirements for the multiple VMs to be created on that cluster. Creation requirements include at least one VM specification parameter, which describes the required specifications of the VM. For example, VM specification parameters may include the number of CPU cores, memory size, storage capacity, network requirements, VM model, rack, bay, availability zone, etc. VM requirement information includes the resource requirements for each VM to be created. The resource requirements for a VM refer to the hardware resources that the physical machine needs to provide to the VM. For example, the resource requirements for a VM include at least one of the following: the number of CPU cores, memory size, and storage capacity.

[0050] Specifically, the scheduling device obtains virtual machine creation requests, determines the initial physical machine cluster and the virtual machine demand information for the initial physical machine cluster based on the virtual machine creation requests, and performs resource scheduling on the initial physical machine cluster based on the virtual machine demand information to obtain a final scheduling scheme. The final scheduling scheme includes the final allocated physical machines corresponding to the multiple virtual machines to be created. The final allocated physical machine for a virtual machine refers to the physical machine that is finally assigned to create that virtual machine. Subsequently, the scheduling device can instruct the corresponding physical machines in the initial physical machine cluster to create the corresponding virtual machines according to the final scheduling scheme.

[0051] In one embodiment, the user terminal sends a virtual machine creation request to the scheduling device. The virtual machine creation request carries a physical machine cluster identifier and virtual machine requirement information. The scheduling device can obtain the physical machine cluster corresponding to the physical machine cluster identifier as the initial physical machine cluster. Alternatively, the scheduling device can obtain the physical machine cluster corresponding to the physical machine cluster identifier and perform preliminary screening of the physical machine clusters based on the virtual machine requirement information to obtain the initial physical machine cluster. It can be understood that the virtual machine requirement information includes not only the resource requirement information corresponding to each of the multiple virtual machines to be created, but also other hard requirement information corresponding to each of the multiple virtual machines to be created. The scheduling device can obtain physical machines from the physical machine cluster corresponding to the physical machine cluster identifier that meet the resource requirement information or other hard requirement information to form the initial physical machine cluster.

[0052] It's understandable that user terminals might initiate multiple virtual machine creation requests within a short period. The scheduling device can merge virtual machine creation requests targeting the same physical machine cluster identifier to obtain virtual machine demand information for the initial physical machine cluster. Based on this demand information, resource scheduling is performed on the initial physical machine cluster to obtain the final scheduling scheme. "Short time" refers to a relatively short time span, the specific time span of which can be set as needed.

[0053] Step S204: Determine the current virtual machine from multiple virtual machines and use the initial physical machine cluster as the candidate physical machine cluster corresponding to the current virtual machine.

[0054] Here, "current virtual machine" refers to the virtual machine currently being scheduled; that is, the virtual machine whose scheduling onto a physical machine needs to be determined. The candidate physical machine cluster corresponding to the current virtual machine is the physical machine cluster from which the physical machine to be scheduled is located; in other words, it is the physical machine cluster from which the schedulable physical machine corresponding to the current virtual machine is selected.

[0055] Specifically, when performing resource scheduling, the scheduling device first selects one virtual machine from multiple virtual machines as the current virtual machine, uses the initial physical machine cluster as the candidate physical machine cluster corresponding to the current virtual machine, and determines the schedulable physical machine corresponding to the current virtual machine from the candidate physical machine cluster. The schedulable physical machine corresponding to the current virtual machine is a physical machine that can be used to create the current virtual machine.

[0056] It's understandable that a virtual machine can be randomly selected from multiple virtual machines as the current virtual machine. Alternatively, a virtual machine can be selected from multiple virtual machines based on specific conditions. For example, virtual machines can be selected sequentially from those with the largest to the smallest resource requirements. Another example is selecting virtual machines sequentially from those whose corresponding request creation times are earliest to latest.

[0057] Step S206: Determine at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster. Based on the idle resource information corresponding to the at least one candidate physical machine and the demand resource information corresponding to the current virtual machine, predict the amount of physical machine cluster fragments generated by allocating the current virtual machine to each candidate physical machine.

[0058] The candidate physical machine for the current virtual machine is a physical machine in the candidate physical machine cluster that can accommodate the current virtual machine; that is, a physical machine that can be used to create the current virtual machine. It can be understood that the candidate physical machine cluster includes multiple physical machines, and at least one candidate physical machine can be determined from the candidate physical machine cluster.

[0059] The idle resource information corresponding to a physical machine refers to the remaining hardware resources of the physical machine that are available for creating virtual machines. For example, the idle resource information corresponding to a physical machine includes at least one of the following: the number of idle CPU cores, the amount of memory, and the storage capacity. The idle resource information corresponding to a candidate allocation physical machine refers to the remaining hardware resources of the candidate allocation physical machine that are available for creating virtual machines.

[0060] It's understandable that a candidate physical machine cluster comprises multiple physical machines. If the current virtual machine is assigned to a physical machine within this cluster, creating that virtual machine requires consuming some of its hardware resources. This reduces the available resources of that physical machine, leading to a decrease in the available resources of the candidate physical machine cluster. When the available resources of a physical machine become insufficient to create a new virtual machine, that machine generates resource fragmentation. The amount of fragmentation in a physical machine cluster refers to the total amount of resource fragments generated by each physical machine within the cluster. Resource fragmentation characterizes the available resources in a physical machine that cannot be used to create a virtual machine. Specifically, it can mean that the remaining available resources in a physical machine are less than the minimum resource requirements of the virtual machine to be created. In this case, the virtual machine cannot be created on the physical machine. For example, if the minimum requirement for the virtual machine to be created is a 4-core CPU, and the physical machine has only 2 idle CPUs, clearly, 2 CPUs cannot meet the minimum requirements. Therefore, the 2 CPUs in that physical machine are considered resource fragments. If one CPU core is considered a unit of resource fragmentation, then the physical machine contains two units of resource fragmentation. Understandably, the same applies to other resources. If the memory and storage capacity are less than the minimum required resources for the virtual machine to be created, then the memory and storage capacity of this space resource are the resource fragments generated in the physical machine.

[0061] Specifically, the scheduling device determines the candidate physical machines for the current virtual machine from the candidate physical machine cluster corresponding to the current virtual machine, and selects the physical machines in the candidate physical machine cluster that can accommodate the current virtual machine as candidate allocation physical machines. Specifically, the candidate allocation physical machines for the current virtual machine can be determined from the candidate physical machine cluster based on the idle resource information of the physical machines and the resource demand information of the current virtual machine. For example, if the candidate physical machine cluster corresponding to the current virtual machine includes physical machine 1, physical machine 2, and physical machine 3, and the idle resource information of physical machine 1, physical machine 2, and physical machine 3 is 8 cores, 8 cores, and 6 cores respectively, and the resource demand information of the current virtual machine is 4 cores, then physical machine 1, physical machine 2, and physical machine 3 can each be selected as candidate allocation physical machines for the current virtual machine.

[0062] Furthermore, the scheduling device predicts the amount of physical machine cluster fragmentation that would result from allocating the current virtual machine to each candidate physical machine, based on the idle resource information corresponding to the candidate physical machines and the resource demand information corresponding to the current virtual machine. For any candidate physical machine, if the current virtual machine is allocated to it, the fragmentation amount of the current physical machine corresponding to the candidate physical machine is updated based on the idle resource information and the resource demand information of the current virtual machine. The fragmentation amounts of the current physical machines corresponding to other physical machines in the candidate physical machine cluster remain unchanged. Based on the fragmentation amounts of the current physical machines corresponding to each physical machine in the candidate physical machine cluster, the total fragmentation amount of the physical machine cluster resulting from allocating the current virtual machine to a candidate physical machine is obtained. That is, the fragmentation amount of the physical machine cluster includes the resource fragmentation amount generated in the physical machine that allocates the virtual machine and the resource fragmentation amount that remains unchanged in the physical machines that do not allocate virtual machines.

[0063] For example, the candidate physical machine cluster corresponding to the current virtual machine includes physical machine 1, physical machine 2, and physical machine 3. The idle resource information corresponding to physical machine 1, physical machine 2, and physical machine 3 is 8 cores, 8 cores, and 6 cores, respectively. Assume that if the idle resource information corresponding to a physical machine is less than 4 cores, the physical machine will experience resource fragmentation. Assume that the resource requirement information corresponding to the current virtual machine is 4 cores.

[0064] If the current virtual machine is assigned to physical machine 1, the idle resource information for physical machine 1 will be updated to 4 cores, while the idle resource information for physical machines 2 and 3 will remain 8 cores and 6 cores respectively. If the current virtual machine is assigned to physical machine 1, no resource fragmentation will occur on physical machines 1, 2, and 3, resulting in 0 fragments in the physical machine cluster. If the current virtual machine is assigned to physical machine 3, the idle resource information for physical machine 3 will be updated to 2 cores. Physical machine 3 will generate resource fragmentation; if 1 core corresponds to 1 resource fragment, then physical machine 3 will generate 2 resource fragments. The idle resource information for physical machines 1 and 2 will remain 8 cores and 8 cores respectively. If the current virtual machine is assigned to physical machine 3, no resource fragmentation will occur on physical machines 1 and 2, while physical machine 3 will generate 2 resource fragments, resulting in 2 fragments in the physical machine cluster.

[0065] In one embodiment, for any candidate physical machine, based on the resource demand information corresponding to the current virtual machine, the idle resource information corresponding to the candidate physical machine is updated; when the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragment quantity of the candidate physical machine is updated to a first fragment quantity; when the updated idle resource information is not empty and is less than or equal to the preset idle resource information, the current physical machine fragment quantity of the candidate physical machine is updated to a second fragment quantity; the first fragment quantity is less than the second fragment quantity; based on the current physical machine fragment quantity of each physical machine in the candidate physical machine cluster, the physical machine cluster fragment quantity generated by allocating the current virtual machine to the candidate physical machine is obtained.

[0066] Step S208: Based on the fragmentation amount of the physical machine cluster and the number of remaining virtual machines, determine the reference allocation physical machine corresponding to the current virtual machine from each candidate allocation physical machine. Based on the resource demand information corresponding to the current virtual machine, update the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster to obtain each intermediate physical machine cluster corresponding to the current virtual machine.

[0067] The remaining number of virtual machines refers to the number of virtual machines that still need to be scheduled. For example, if there are 8 virtual machines to be created, first, one virtual machine is selected from the 8 virtual machines as the current virtual machine, then the remaining number of virtual machines is 7. After determining the reference allocation physical machine corresponding to the current virtual machine, another virtual machine is selected from the remaining 7 virtual machines as the current virtual machine, then the remaining number of virtual machines is 6, and so on.

[0068] The reference physical machine assigned to the current virtual machine is a further selected physical machine from the candidate physical machines assigned to the current virtual machine. Clearly, the reference physical machine assigned to the current virtual machine is also a physical machine within the candidate physical machine cluster that can accommodate the current virtual machine. Based on the fragmentation level of the physical machine cluster and the number of remaining virtual machines, the reference physical machine assigned to the current virtual machine is determined from each candidate physical machine.

[0069] The candidate physical machine cluster corresponding to the current virtual machine is the cluster of physical machines for which the schedulable physical machines corresponding to the current virtual machine are to be determined. From the candidate physical machine cluster, the reference allocated physical machine corresponding to the current virtual machine is determined. The intermediate physical machine cluster corresponding to the current virtual machine is the cluster of physical machines for which the schedulable physical machines corresponding to the current virtual machine have already been determined. Based on the resource demand information corresponding to the current virtual machine, the idle resource information corresponding to a single reference allocated physical machine in the candidate physical machine cluster is updated to obtain a single intermediate physical machine cluster corresponding to the current virtual machine. It can be understood that the difference between the candidate physical machine cluster and the intermediate physical machine cluster corresponding to the current virtual machine lies in the idle resource information of the reference allocated physical machines. Typically, the idle resources of the reference allocated physical machines in the candidate physical machine cluster are greater than the idle resources of the reference allocated physical machines in the intermediate physical machine cluster.

[0070] For example, the candidate physical machine cluster corresponding to the current virtual machine includes physical machine 1, physical machine 2, and physical machine 3. The idle resource information corresponding to physical machine 1, physical machine 2, and physical machine 3 is 8 cores, 8 cores, and 6 cores, respectively. Assume that the resource requirement of the current virtual machine is 4 cores. If physical machine 1 is used as the reference allocated physical machine for the current virtual machine, then the intermediate physical machine cluster corresponding to the current virtual machine includes physical machine 1, physical machine 2, and physical machine 3. The idle resource information corresponding to physical machine 1, physical machine 2, and physical machine 3 is 4 cores, 8 cores, and 6 cores, respectively.

[0071] It is understandable that there can be at least one reference physical machine for the current virtual machine, and therefore at least one intermediate physical machine cluster for the current virtual machine. Each intermediate physical machine cluster for the current virtual machine represents a possible scheduling or allocation method for the current virtual machine. For example, using physical machine 1 as the reference physical machine for the current virtual machine is one possible scheduling method, using physical machine 2 as the reference physical machine for the current virtual machine is another possible scheduling method, and so on.

[0072] Specifically, after determining the candidate physical machines for the current virtual machine, the scheduling device further determines the reference physical machine for the current virtual machine from among the candidate physical machines based on the physical machine cluster fragmentation level and the number of remaining virtual machines. For example, the scheduling device can determine a physical machine cluster fragmentation threshold based on the physical machine cluster fragmentation level and the number of remaining virtual machines, compare the physical machine cluster fragmentation level resulting from the current virtual machine being allocated to a candidate physical machine with the physical machine cluster fragmentation threshold, determine the candidate physical machines corresponding to physical machine cluster fragmentation levels less than the physical machine cluster fragmentation threshold, and use the determined candidate physical machines as the reference physical machines for the current virtual machine. As another example, the scheduling device can determine a physical machine cluster fragmentation threshold based on the number of remaining virtual machines, where the physical machine cluster fragmentation threshold and the number of remaining virtual machines are positively correlated, compare the physical machine cluster fragmentation level resulting from the current virtual machine being allocated to a candidate physical machine with the physical machine cluster fragmentation threshold, and use the candidate physical machines corresponding to physical machine cluster fragmentation levels less than the physical machine cluster fragmentation threshold as the reference physical machines for the current virtual machine. It is understandable that if the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to the candidate physical machine is greater than or equal to the physical machine cluster fragmentation threshold, it means that too much resource fragmentation has been generated. Allocating the remaining virtual machines based on this allocation method will only generate more resource fragmentation. Therefore, there is no need to use the candidate physical machine as a reference physical machine and this allocation method should be discarded.

[0073] After determining the reference allocated physical machines corresponding to the current virtual machine, the scheduling device further updates the idle resource information corresponding to each reference allocated physical machine in the candidate physical machine cluster based on the resource demand information of the current virtual machine, thus obtaining the intermediate physical machine clusters corresponding to the current virtual machine. Each update of one reference allocated physical machine in the candidate physical machine cluster results in one intermediate physical machine cluster.

[0074] Step S210: Take the intermediate physical machine cluster as the candidate physical machine cluster corresponding to the next virtual machine, take the next virtual machine as the current virtual machine, and return to the step of determining at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster, until the candidate physical machine cluster and each candidate physical machine corresponding to the last virtual machine are obtained.

[0075] The last virtual machine refers to the last virtual machine that needs to be scheduled.

[0076] Specifically, based on the various feasible scheduling schemes for the already scheduled virtual machines, the scheduling device continues to perform resource scheduling for the next virtual machine that needs to be scheduled, determining the physical machines that the next virtual machine can be further scheduled to in the existing feasible schemes. That is, after determining the intermediate physical machine clusters corresponding to the current virtual machine, the scheduling device uses the intermediate physical machine clusters corresponding to the current virtual machine as the candidate physical machine clusters corresponding to the next virtual machine, uses the next virtual machine as the current virtual machine, and returns to step S206 for execution to obtain the new intermediate physical machine clusters corresponding to the current virtual machine. Then, it uses the new intermediate physical machine clusters corresponding to the current virtual machine as the candidate physical machine clusters corresponding to the new next virtual machine, uses the new next virtual machine as the current virtual machine, and returns to step S206 for execution, and so on, until the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocated physical machine are obtained.

[0077] It's understandable that selecting a reference physical machine from the candidate allocation machines is to filter out allocation schemes that will generate a large amount of resource fragmentation later. Since the last virtual machine is the final virtual machine, for that last virtual machine, we can choose to determine only the candidate allocation machines corresponding to it. Alternatively, we can choose to further determine the reference allocation machine for the last virtual machine from among the various candidate allocation machines.

[0078] Step S212: Based on the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocation physical machine, obtain each reference physical machine cluster. From each reference physical machine cluster, determine the final scheduling scheme corresponding to the virtual machine requirement information. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

[0079] The reference physical machine cluster represents a feasible scheduling scheme that meets the virtual machine requirements of the initial physical machine cluster. Each reference physical machine cluster represents a different feasible scheduling scheme, and the final scheduling scheme is determined from these schemes. The final scheduling scheme refers to the ultimately determined scheduling scheme. The final reference physical machine cluster refers to the physical machine cluster ultimately used as the resource scheduling reference from the various reference physical machine clusters. The reference physical machine cluster is the physical machine cluster obtained by allocating the multiple virtual machines to be created among the predicted reference allocation physical machines.

[0080] Specifically, after determining the candidate physical machines corresponding to the last virtual machine, the scheduling device obtains various reference physical machine clusters based on these candidate physical machines and the candidate physical machine clusters. For example, based on the resource demand information of the last virtual machine, the device can update the idle resource information of each candidate physical machine in the candidate physical machine cluster to obtain various reference physical machine clusters. Each reference physical machine cluster represents a different feasible scheduling scheme obtained by resource scheduling based on the virtual machine demand information within the initial physical machine cluster. Finally, the scheduling device determines the final scheduling scheme corresponding to the virtual machine demand information from the various reference physical machine clusters. The final scheduling scheme can be determined based on any one of the reference physical machine clusters. Alternatively, a reference physical machine cluster can be selected based on specific conditions to determine the final scheduling scheme. For example, the final scheduling scheme can be determined based on the reference physical machine cluster with the smallest fragmentation. Another example is determining the physical machine with the best soft conditions from the initial physical machine cluster as the target physical machine, comparing the idle resource information of the target physical machine in each reference physical machine cluster, and determining the final scheduling scheme based on the reference physical machine containing the target physical machine with the smallest idle resource information. Soft conditions can be set as needed. For example, at least one indicator reflecting the performance of a physical machine, such as the physical machine's health (measured stable runtime on a percentage scale) or affinity (preventing a single physical machine failure from affecting multiple virtual machines), can be used as a soft condition.

[0081] After determining the final scheduling scheme, the scheduling device can create the corresponding virtual machines on the physical machines in the initial physical machine cluster according to the final scheduling scheme. For example, if the final scheduling scheme instructs virtual machine 1 and virtual machine 3 to be scheduled to physical machine A in the initial physical machine cluster, then the scheduling device can instruct physical machine A to create virtual machine 1 and virtual machine 3.

[0082] Furthermore, referring to Figure 3, the specific resource scheduling process is illustrated. The initial physical machine cluster consists of 3 physical machines. Physical machine 1 has 8 idle cores, physical machine 2 has 12 idle cores, and physical machine 3 has 6 idle cores. The virtual machines to be created include virtual machine A and virtual machine B. Virtual machine A requires 4 cores, and virtual machine B requires 8 cores. If a physical machine has less than 4 idle cores, resource fragmentation occurs, with 1 core corresponding to 1 resource fragment.

[0083] First, virtual machine A is designated as the current virtual machine, and the initial physical machine cluster is designated as the candidate physical machine cluster corresponding to virtual machine A. Since all three physical machines can accommodate virtual machine A, the candidate allocation physical machines corresponding to virtual machine A include three physical machines. If virtual machine A is allocated to physical machine 1, the resulting physical machine cluster fragmentation (i.e., the total fragmentation of the three physical machines) is 0. If virtual machine A is allocated to physical machine 2, the resulting physical machine cluster fragmentation is 0. If virtual machine A is allocated to physical machine 3, the resulting physical machine cluster fragmentation is 2. If the physical machine cluster fragmentation threshold determined based on the number of remaining virtual machines is 2, then the candidate allocation physical machines corresponding to physical machine cluster fragmentation less than 2 are used as reference allocation physical machines. Therefore, the candidate allocation physical machines corresponding to virtual machine A include two physical machines, namely physical machine 1 and physical machine 2. Based on the required resource information corresponding to virtual machine A, the idle resource information corresponding to physical machine 1 in the candidate physical machine cluster is updated to obtain the intermediate physical machine cluster a1 corresponding to virtual machine A. In the intermediate physical machine cluster a1, the idle resource information corresponding to physical machines 1, 2, and 3 are 4 cores, 12 cores, and 6 cores, respectively. Based on the resource requirements of virtual machine A, the idle resource information of physical machine 2 in the candidate physical machine cluster is updated to obtain the intermediate physical machine cluster a2 corresponding to virtual machine A. In the intermediate physical machine cluster a2, the idle resource information of physical machines 1, 2 and 3 are 8 cores, 8 cores and 6 cores respectively.

[0084] Next, taking virtual machine B as the current virtual machine, and intermediate physical machine cluster a1 as the candidate physical machine cluster corresponding to virtual machine B, since only physical machine 2 in intermediate physical machine cluster a1 can accommodate virtual machine B, the candidate physical machine for virtual machine B is physical machine 2. Based on the resource requirements information corresponding to virtual machine B, the idle resource information corresponding to physical machine 2 in intermediate physical machine cluster a1 is updated to obtain reference physical machine cluster b1. In reference physical machine cluster b1, the idle resource information corresponding to physical machines 1, 2, and 3 are 4 cores, 4 cores, and 6 cores, respectively.

[0085] Intermediate physical machine cluster a2 is selected as the candidate physical machine cluster for virtual machine B. Since only physical machines 1 and 2 in intermediate physical machine cluster a2 can accommodate virtual machine B, the candidate physical machines for virtual machine B include physical machines 1 and 2. Based on the resource requirements of virtual machine B, the idle resource information of physical machine 1 in intermediate physical machine cluster a2 is updated to obtain reference physical machine cluster b2. In reference physical machine cluster b2, the idle resource information of physical machines 1, 2, and 3 are 0 cores, 8 cores, and 6 cores, respectively. Based on the resource requirements of virtual machine B, the idle resource information of physical machine 2 in intermediate physical machine cluster a2 is updated to obtain reference physical machine cluster b3. In reference physical machine cluster b3, the idle resource information of physical machines 1, 2, and 3 are 8 cores, 0 cores, and 6 cores, respectively.

[0086] The fragmentation level of physical machine clusters b1, b2, and b3 is 0. Any one of these schemes can be chosen as the final scheduling scheme. If physical machine cluster b1 is chosen as the final scheduling scheme, then virtual machine A needs to be created on physical machine 1 in the initial physical machine cluster, and virtual machine B needs to be created on physical machine 2 in the initial physical machine cluster.

[0087] In the above resource scheduling method, virtual machine demand information for the initial physical machine cluster is obtained. This demand information includes the resource requirements of each of the multiple virtual machines to be created. Based on this demand information, the physical machines corresponding to each virtual machine are determined from the initial physical machine cluster, resulting in the final scheduling scheme. Specifically, the current virtual machine is selected from the multiple virtual machines, and the initial physical machine cluster is used as the candidate physical machine cluster for the current virtual machine. From the candidate physical machine cluster, physical machines capable of accommodating the current virtual machine are selected as candidate allocation physical machines. Based on the idle resource information of the candidate allocation physical machines and the resource requirements of the current virtual machine, the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate allocation physical machine is predicted. Based on the physical machine cluster fragmentation and the remaining number of virtual machines, unsuitable candidate allocation physical machines are further filtered out from the candidate allocation physical machines to obtain the reference allocation physical machine for the current virtual machine. This method, based on the physical machine cluster fragmentation and the remaining number of virtual machines, pre-filters scheduling schemes unsuitable for further allocation of the remaining virtual machines. This not only effectively improves the resource utilization of physical machines and avoids excessive resource fragmentation leading to resource waste in the final scheduling scheme, but also effectively reduces the workload of subsequent allocation and improves resource scheduling efficiency. Based on the resource requirements of the current virtual machine, the idle resource information of each reference allocated physical machine in the candidate physical machine cluster is updated to obtain the intermediate physical machine clusters corresponding to the current virtual machine. Each intermediate physical machine cluster can indicate various feasible scheduling schemes for the current virtual machine. The intermediate physical machine clusters are used as candidate physical machine clusters for the next virtual machine, and the next virtual machine is used as the current virtual machine. The above steps are repeated to determine the intermediate physical machine clusters corresponding to the next virtual machine, and so on, until the candidate physical machine cluster and candidate allocated physical machine corresponding to the last virtual machine (i.e., the last virtual machine) are obtained. Based on the candidate allocated physical machines and candidate physical machine clusters corresponding to the last virtual machine, each reference physical machine cluster is obtained. In this way, the next virtual machine is allocated based on the various feasible scheduling schemes of the current virtual machine, which can determine multiple feasible scheduling schemes from multiple perspectives, which helps to improve the resource utilization of physical machines. Furthermore, the various feasible scheduling schemes of the last virtual machine naturally include the allocation methods of the previous virtual machines, so the final scheduling scheme can be determined through the various feasible scheduling schemes of the last virtual machine. In summary, during resource scheduling, the allocation method for each virtual machine is determined sequentially, and the feasible allocation method for the next virtual machine is determined based on the feasible allocation methods of the current virtual machine, thus achieving dynamic allocation and ensuring the resource utilization of the final allocation method. Furthermore, when determining the feasible allocation method for a single virtual machine, allocation methods that are not suitable for continuing to allocate the remaining virtual machines are filtered out in advance, which can further improve resource utilization and resource scheduling efficiency.

[0088] In one embodiment, determining the candidate physical machine for the current virtual machine from the candidate physical machine cluster includes:

[0089] From the candidate physical machine cluster, select physical machines whose idle resource information is greater than or equal to the resource demand information corresponding to the current virtual machine, and use them as candidate physical machines for allocation to the current virtual machine.

[0090] Specifically, when determining the candidate physical machine for the current virtual machine from the candidate physical machine cluster, the scheduling device can compare the idle resource information of each physical machine in the candidate physical machine cluster with the required resource information of the current virtual machine. The physical machine whose idle resource information is greater than or equal to the required resource information is selected as the candidate physical machine for the current virtual machine. For example, if physical machine A has an idle resource information of 4 CPU cores and a required resource information of 4 CPU cores, and the idle resource information and required resource information are equal, then physical machine A is selected as the candidate physical machine for the current virtual machine. In the above embodiment, selecting physical machines from the candidate physical machine cluster whose idle resource information is greater than or equal to the required resource information of the current virtual machine as candidate physical machines ensures that the candidate physical machines can accommodate the current virtual machine, improving the accuracy of resource scheduling.

[0091] In one embodiment, based on the idle resource information corresponding to the candidate physical machines and the resource demand information corresponding to the current virtual machine, the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine is predicted, including:

[0092] For any candidate physical machine to be allocated, update the available resource information of the candidate physical machine based on the resource demand information of the current virtual machine.

[0093] When the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to the first fragment quantity;

[0094] When the updated idle resource information is not empty and is less than or equal to the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to the second fragment quantity that matches the updated idle resource information; the first fragment quantity is less than the second fragment quantity.

[0095] Based on the current physical machine fragmentation of each physical machine in the candidate physical machine cluster, the physical machine cluster fragmentation generated by allocating the current virtual machine to the candidate physical machine is obtained.

[0096] The preset idle resource information refers to a threshold that is pre-set for idle resource information. The preset idle resource information can be set according to specific needs. For example, based on the minimum resource requirements of a virtual machine, the preset idle resource information can be determined. If the minimum number of CPU cores required for the smallest virtual machine that can be created (i.e., the minimum resource requirements of the virtual machine) is 4 cores, then the preset idle resource information can be set to 3 cores.

[0097] The current physical machine fragmentation amount of the candidate physical machine corresponding to the current virtual machine in the candidate physical machine cluster refers to the amount of physical machine fragmentation generated by the candidate physical machine if the current virtual machine is assigned to it. The current physical machine fragmentation amount of other physical machines in the candidate physical machine cluster refers to the amount of physical machine fragmentation already generated by other physical machines.

[0098] Specifically, there can be at least one candidate physical machine for the current virtual machine. For any candidate physical machine, the scheduling device predicts the amount of physical machine cluster fragmentation that would result from allocating the current virtual machine to a candidate physical machine, based on the idle resource information of the candidate physical machine and the resource demand information of the current virtual machine. The scheduling device updates the idle resource information of the candidate physical machine corresponding to the current virtual machine's resource demand information, compares the updated idle resource information of the candidate physical machine with the preset idle resource information, and updates the amount of physical machine fragmentation corresponding to the candidate physical machine in the candidate physical machine cluster corresponding to the current virtual machine based on the comparison result. It can be understood that for other physical machines in the candidate physical machine cluster corresponding to the current virtual machine besides the candidate physical machine, there is no need to update the physical machine fragmentation of other physical machines at present. If the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragmentation of the candidate physical machine is updated to a first fragmentation quantity. If the updated idle resource information is not empty, and the updated idle resource information is less than or equal to the preset idle resource information, the current physical machine fragmentation of the candidate physical machine is updated to a second fragmentation quantity, where the first fragmentation quantity is less than the second fragmentation quantity. Ultimately, the scheduling device determines the amount of physical machine cluster fragments generated by allocating the current virtual machine to a candidate physical machine based on the current physical machine fragmentation amount of each physical machine in the candidate physical machine cluster.

[0099] It is understandable that the number of second fragments can be any number less than the number of first fragments. However, to improve accuracy, the scheduling device can determine the number of second fragments based on the updated idle resource information. When the updated idle resource information is less than or equal to the preset idle resource information, the current fragment quantity of the candidate physical machine is updated to the number of second fragments that matches the updated idle resource information. The number of second fragments is positively correlated with the updated idle resource information; the larger the updated idle resource information, the larger the number of second fragments.

[0100] In one embodiment, the first fragment quantity is 0, and the second fragment quantity is a value equal to the updated idle resource information.

[0101] Referring to Figure 4, the current virtual machine requires 4 CPU cores. The candidate physical machine cluster corresponding to the current virtual machine includes physical machine 1, physical machine 2, physical machine 3, and physical machine 4. The remaining CPU cores of physical machines 1, 2, 3, and 4 are 8, 12, 6, and 4 cores, respectively. Assuming that if a physical machine has fewer than 4 remaining CPU cores, resource fragmentation occurs, with 1 core corresponding to 1 resource fragment. Conversely, if a physical machine has 0 remaining CPU cores, the resource utilization is 100%, and there is no resource fragmentation. Before scheduling the current virtual machine, the fragmentation of physical machines 1, 2, 3, and 4 is 0, and the fragmentation of the physical machine cluster is 0. If the current virtual machine is assigned to physical machine 1, the remaining CPU cores of physical machine 1 are updated to 4 cores. Physical machine 1 will not generate resource fragmentation, and the fragmentation of the physical machine cluster resulting from assigning the current virtual machine to physical machine 1 remains 0. If the current virtual machine is assigned to physical machine 2, the remaining CPU cores on physical machine 2 will be updated to 8 cores. Physical machine 2 will not generate resource fragmentation, so the fragmentation level of the physical machine cluster resulting from assigning the current virtual machine to physical machine 2 will remain 0. If the current virtual machine is assigned to physical machine 3, the remaining CPU cores on physical machine 3 will be updated to 2 cores. Physical machine 3 will generate 2 resource fragments, so the fragmentation level of the physical machine cluster resulting from assigning the current virtual machine to physical machine 3 will be 2. If the current virtual machine is assigned to physical machine 4, the remaining CPU cores on physical machine 4 will be updated to 0 cores. Physical machine 4 will not generate resource fragmentation, so the fragmentation level of the physical machine cluster resulting from assigning the current virtual machine to physical machine 4 will remain 0.

[0102] In the above embodiments, if the current virtual machine is assigned to a candidate physical machine, the idle resource information of the candidate physical machine is updated based on the resource demand information corresponding to the current virtual machine. When the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragmentation of the candidate physical machine is updated to a first fragmentation quantity. When the updated idle resource information is not empty and is less than or equal to the preset idle resource information, the current physical machine fragmentation of the candidate physical machine is updated to a second fragmentation quantity that matches the updated idle resource information. The first fragmentation quantity is less than the second fragmentation quantity. Therefore, the current physical machine fragmentation of the candidate physical machine can accurately reflect the resource utilization of the candidate physical machine after the current virtual machine is assigned to it, which helps to ensure the accuracy of resource scheduling. Based on the current physical machine fragmentation of each physical machine in the candidate physical machine cluster corresponding to the current virtual machine, the physical machine cluster fragmentation generated by assigning the current virtual machine to the candidate physical machine is obtained. The physical machine cluster fragmentation can accurately reflect the resource utilization of the physical machine cluster after the current virtual machine is assigned to the candidate physical machine, which helps to ensure the accuracy of resource scheduling.

[0103] In one embodiment, determining the reference physical machine corresponding to the current virtual machine from among the candidate physical machines based on the physical machine cluster fragmentation and the number of remaining virtual machines includes:

[0104] Determine the minimum fragmentation amount from the fragmentation amounts of each physical machine cluster;

[0105] The physical machine cluster fragmentation threshold is obtained based on the minimum fragmentation amount and the number of remaining virtual machines;

[0106] The candidate physical machines corresponding to the fragmentation amount of the physical machine cluster that is smaller than the physical machine cluster fragmentation threshold are used as the reference physical machines for the current virtual machine.

[0107] The minimum fragmentation amount is the smallest physical machine cluster fragmentation amount among the physical machine cluster fragmentation amounts generated by allocating the current virtual machine to each candidate physical machine. This can be determined by comparing the fragmentation amounts of each physical machine cluster or by sorting them from largest to smallest. The physical machine cluster fragmentation threshold is a threshold for the physical machine cluster fragmentation amount, used to filter reference physical machines from the candidate physical machines.

[0108] Specifically, the scheduling device can determine the physical machine cluster fragmentation threshold based on the physical machine cluster fragmentation amount and the number of remaining virtual machines, and determine the reference allocation physical machine corresponding to the current virtual machine from each candidate allocation physical machine based on the physical machine cluster fragmentation threshold and the physical machine cluster fragmentation amount corresponding to each candidate allocation physical machine.

[0109] The scheduling device selects the minimum fragmentation value from the fragmentation amounts across all physical machine clusters as the minimum fragmentation amount. Based on this minimum fragmentation amount and the remaining number of virtual machines (VMs), a physical machine cluster fragmentation threshold is derived. The physical machine cluster fragmentation threshold is positively correlated with both the minimum fragmentation amount and the remaining number of VMs. For example, the sum of the minimum fragmentation amount and the remaining number of VMs can be used as the physical machine cluster fragmentation threshold. It can be understood that the physical machine cluster fragmentation amount reflects the resource utilization of the physical machine cluster; a larger fragmentation amount indicates poorer resource utilization. Since there are multiple candidate physical machines for the current VM, assigning the current VM to a candidate physical machine that produces the minimum fragmentation amount is a resource scheduling result with good current resource utilization. Regarding the remaining number of VMs, in the worst-case scenario, each remaining VM can generate resource fragmentation on a different physical machine. Therefore, the remaining number of VMs can be used to predict resource scheduling results with poor resource utilization. Therefore, the physical machine cluster fragmentation threshold, determined based on the minimum fragmentation amount and the number of remaining virtual machines, reflects the maximum or larger value of the predicted physical machine cluster fragmentation amount that can be generated when continuing resource scheduling of the remaining virtual machines based on the resource scheduling scheme corresponding to the minimum fragmentation amount. If the physical machine cluster fragmentation amount obtained by resource scheduling of the current virtual machine is already greater than or equal to the physical machine cluster fragmentation threshold, it means that continuing resource scheduling of the remaining virtual machines under this situation will only lead to increasingly worse resource utilization. In this case, it is advisable to stop the loss in time and abandon the corresponding resource scheduling scheme. Therefore, after determining the physical machine cluster fragmentation threshold, the scheduling device can use the candidate physical machines corresponding to physical machine cluster fragmentation amounts smaller than the physical machine cluster fragmentation threshold as the reference physical machines for the current virtual machine.

[0110] In the above embodiments, the minimum fragmentation amount is determined from the fragmentation amount of each physical machine cluster. Based on the minimum fragmentation amount and the number of remaining virtual machines, the physical machine cluster fragmentation threshold is obtained. The physical machine cluster fragmentation threshold represents the expected maximum physical machine cluster fragmentation amount. The candidate physical machines corresponding to the physical machine cluster fragmentation amount smaller than the physical machine cluster fragmentation threshold are used as the reference physical machines corresponding to the current virtual machines. This can ensure the resource utilization of physical machines and avoid excessive resource fragmentation in the physical machine cluster.

[0111] In one embodiment, determining the final scheduling scheme corresponding to the virtual machine demand information from each reference physical machine cluster includes:

[0112] Based on the amount of physical machine cluster fragments corresponding to each reference physical machine cluster, the final reference physical machine cluster is determined from each reference physical machine cluster.

[0113] Based on the final reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is obtained.

[0114] The final reference physical machine cluster is a physical machine cluster that is further selected from the various reference physical machine clusters.

[0115] Specifically, after obtaining each reference physical machine cluster, the scheduling device can determine the final reference physical machine cluster based on the fragmentation level of each reference physical machine cluster. For example, by comparing the fragmentation levels or sorting them from largest to smallest, the device can determine the reference physical machine cluster with the smallest fragmentation level and use it as the final reference physical machine cluster. Finally, based on the final reference physical machine cluster, the scheduling device obtains the final scheduling scheme corresponding to the virtual machine requirement information.

[0116] In the above embodiments, based on the physical machine cluster fragmentation amount corresponding to each reference physical machine cluster, the final reference physical machine cluster is determined from each reference physical machine cluster, so that the final reference physical machine cluster has a small physical machine cluster fragmentation amount, and the final scheduling scheme obtained based on the final reference physical machine cluster can guarantee the resource utilization rate of physical machines.

[0117] In one embodiment, determining the final reference physical machine cluster from the various reference physical machine clusters based on the amount of physical machine cluster fragmentation corresponding to each reference physical machine cluster includes:

[0118] From all the reference physical machine clusters, select the one with the smallest fragmentation as the final reference physical machine cluster.

[0119] Specifically, when determining the final reference physical machine cluster from various reference physical machine clusters, the scheduling device can select the reference physical machine cluster with the smallest physical machine cluster fragmentation as the final reference physical machine cluster. Thus, the final scheduling scheme based on the final reference physical machine cluster can generate the smallest physical machine cluster fragmentation and has a high resource utilization rate.

[0120] In some embodiments, the scheduling device may first determine whether the fragmentation amount of the physical machine cluster is less than a preset threshold. If it is not less than the preset threshold, the reference physical machine cluster with the smallest fragmentation amount is selected as the final reference physical machine cluster. If it is less than the preset threshold, the reference physical machine cluster with the smallest fragmentation amount is selected as the final reference physical machine cluster. If there are multiple reference physical machine clusters with fragmentation amounts less than the preset threshold, the most suitable final reference physical machine cluster is selected from these clusters based on cluster load and other cluster conditions. For example, the reference physical machine cluster with the smallest load is selected as the final reference physical machine cluster.

[0121] In the above embodiments, the reference physical machine cluster with the smallest physical machine cluster fragmentation is selected from each reference physical machine cluster as the final reference physical machine cluster. This ensures that the final reference physical machine cluster has the smallest physical machine cluster fragmentation, and thus the final scheduling scheme based on the final reference physical machine cluster can generate the smallest physical machine cluster fragmentation, resulting in higher resource utilization.

[0122] In one embodiment, determining the final reference physical machine cluster from the various reference physical machine clusters based on the amount of physical machine cluster fragmentation corresponding to each reference physical machine cluster includes:

[0123] From each reference physical machine cluster, multiple reference physical machine clusters that each have the smallest physical machine cluster fragmentation are selected as physical machine clusters to be sorted.

[0124] For any physical machine cluster to be sorted, based on the remaining space resources of each physical machine in the cluster after allocating virtual machines, determine the upper limit of virtual machine creation specifications for the physical machines in the cluster, and determine the scheduling priority of the physical machine cluster to be sorted based on the upper limit of virtual machine creation specifications for each physical machine in the cluster.

[0125] Based on scheduling priority, the final reference physical machine cluster is determined from each unordered physical machine cluster.

[0126] A physical machine can be divided into multiple resource spaces, each with its own hardware resources. Managing different hardware resources separately through multiple resource spaces improves resource management efficiency. The division of resource spaces can be configured according to actual needs. For example, a physical machine with a 16-core CPU can be divided into two resource spaces: one with 4 CPU cores and the other with 12 CPU cores. The remaining space information for a resource space refers to the available resources within that space.

[0127] A reference physical machine cluster is a physical machine cluster obtained by allocating multiple virtual machines to be created to corresponding physical machines in the initial physical machine cluster. Based on the reference physical machine cluster, it can be determined which physical machines in the initial physical machine cluster need to accommodate which virtual machines. After determining the virtual machines that a physical machine needs to accommodate, resource space can be allocated to the virtual machines based on the resource requirements of the virtual machines and the remaining space information of each resource space of the physical machine. This yields the resource space corresponding to each virtual machine. Then, based on the resource requirements of the virtual machines, the remaining space information of the resource spaces corresponding to the virtual machines is updated, ultimately obtaining the remaining space information of each resource space of the physical machine after allocating virtual machines.

[0128] It's understandable that the specific allocation method for virtual machine resource space can be configured as needed. For example, it could be a round-robin allocation method, where each virtual machine is assigned to a different resource space in turn. If physical machine 1 has m resource spaces and n virtual machines are allocated to it, then the first virtual machine is allocated to resource space 1, the second virtual machine to resource space 2, the third virtual machine to resource space 3, and so on. If resource space 2 cannot accommodate the second virtual machine, then the second virtual machine is allocated to a subsequent resource space that can accommodate it. Another example is an allocation method aimed at minimizing the differences in remaining resource information between different resource spaces. If a resource space has more remaining resource information, then that resource space is allocated to virtual machines with larger or greater resource requirements.

[0129] The upper limit for virtual machine creation specifications corresponding to a physical machine refers to the specific specifications of the largest virtual machine that can be created based on the remaining hardware resources of the physical machine. The upper limit for virtual machine creation specifications can be represented by the resource information required by the virtual machine. For example, if the largest virtual machine that can be created on a physical machine based on its remaining hardware resources is determined to be a 16-core virtual machine, then the upper limit for virtual machine creation specifications corresponding to that physical machine is 16 cores.

[0130] A physical machine cluster to be sorted is any one of the reference physical machine clusters with the smallest fragmentation amount when multiple reference physical machine clusters have the same and smallest fragmentation amount. The scheduling priority corresponding to the physical machine cluster to be sorted refers to the priority of using the physical machine cluster to be sorted as the final reference physical machine cluster.

[0131] Specifically, when determining the final reference physical machine cluster from various reference physical machine clusters, if multiple reference physical machine clusters have the minimum amount of physical machine cluster fragmentation, the scheduling device can randomly select one of these clusters as the final reference physical machine cluster. Alternatively, it can select a reference physical machine cluster based on specific conditions. Specifically, the scheduling device can select the final reference physical machine cluster from the multiple reference physical machine clusters with the minimum amount of physical machine cluster fragmentation based on the maximum virtual machine creation size corresponding to each physical machine in the cluster.

[0132] First, the scheduling device selects multiple reference physical machine clusters with the smallest fragmentation from each reference physical machine cluster as unsorted physical machine clusters, determines the scheduling priority for each unsorted physical machine cluster, and selects the unsorted physical machine cluster with the highest scheduling priority as the final reference physical machine cluster. For any unsorted physical machine cluster, the scheduling device determines the upper limit of virtual machine creation specifications for each physical machine in the cluster based on the remaining space information of each resource space after allocating virtual machines. For example, from the various resource spaces of the physical machine, the resource space with the largest remaining space information is used as the resource space for determining the planning upper limit. Based on the remaining space information of the resource space for determining the planning upper limit, the upper limit of virtual machine creation specifications for the physical machine is obtained. The scheduling device determines the upper limit of virtual machine creation specifications for each physical machine in the unsorted physical machine cluster, and determines the scheduling priority for the unsorted physical machine cluster based on the upper limit of virtual machine creation specifications for each physical machine in the unsorted physical machine cluster. For example, from the various upper limits of virtual machine creation specifications, the scheduling priority for the unsorted physical machine cluster is obtained based on the largest virtual machine creation specification upper limit, with a larger maximum value indicating a higher priority. For example, the average of the upper limits of virtual machine creation specifications is calculated, and the scheduling priority corresponding to the physical machine clusters to be sorted is obtained based on the average value; the larger the average value, the higher the priority. Another example is to obtain the median value from the upper limits of virtual machine creation specifications, and the scheduling priority corresponding to the physical machine clusters to be sorted is obtained based on the median value; the larger the median value, the higher the priority. Finally, the scheduling device determines the final reference physical machine cluster from the various physical machine clusters to be sorted based on the scheduling priorities corresponding to the physical machine clusters to be sorted. For example, the physical machine cluster with the largest upper limit of virtual machine creation specifications is selected as the final reference physical machine cluster.

[0133] In one embodiment, physical machines can establish various resource spaces based on a NUMA (Non-Uniform Memory Access) architecture. Multiple NUMA nodes are established on the physical machines, with each NUMA node representing a resource space. Each NUMA node has its own local memory and a set of processors. Accessing local memory is faster for NUMA nodes than accessing the memory of other nodes (remote access). Each NUMA node may have different memory capacities and processor counts. For any physical machine cluster to be sorted, the upper limit of virtual machine creation specifications for each physical machine in the cluster is determined based on the remaining space resources of each NUMA node after allocating virtual machines.

[0134] In one embodiment, for any physical machine in the cluster, the maximum available space resource is determined from the remaining space resource information in each of the physical machine's resource spaces after allocating virtual machines. This maximum available space resource information is used as the upper limit for the virtual machine creation specification corresponding to the physical machine in the cluster. Considering that there is a certain degree of access speed limitation when creating virtual machines across resource spaces, when creating virtual machines in a single resource space, the maximum available space resource information of the physical machine is used as the upper limit for the virtual machine creation specification corresponding to the physical machine.

[0135] In one embodiment, for any physical machine in the cluster, the minimum available space resources are determined from the remaining space resources in each of the physical machine's resource spaces after allocating virtual machines. Based on the minimum available space resources and the amount of resource space, the upper limit for virtual machine creation specifications corresponding to the physical machine in the cluster is determined. Sometimes, creating virtual machines across resource spaces can create more or larger virtual machines. Therefore, when cross-space virtual machine creation is allowed, the upper limit for virtual machine creation specifications corresponding to the physical machine in the cluster is determined based on the minimum available space resources and the amount of resource space.

[0136] In the above embodiments, multiple reference physical machine clusters with the minimum number of physical machine cluster fragments are selected from each reference physical machine cluster as physical machine clusters to be sorted. Based on the upper limit of virtual machine creation specifications corresponding to each physical machine in the cluster, the scheduling priority of the physical machine clusters to be sorted is determined. Based on the scheduling priority, the final reference physical machine cluster is determined from each physical machine cluster to be sorted, so that the final reference physical machine cluster has a larger upper limit of virtual machine creation specifications, thereby the final reference physical machine cluster can continue to create more virtual machines and further improve the resource utilization of physical machines.

[0137] In one embodiment, based on the remaining space resources of each physical machine in the cluster after allocating virtual machines, the upper limit of the virtual machine creation specification for each physical machine in the cluster is determined, including:

[0138] For any physical machine in the cluster, determine the minimum and maximum space resource information from the remaining space resource information of each resource space of the physical machine after allocating virtual machines;

[0139] A first upper limit is determined based on the minimum spatial resource information and the amount of resource space, and a second upper limit is determined based on the maximum spatial resource information.

[0140] Determine the upper limit of virtual machine creation specifications corresponding to physical machines in the cluster from the first upper limit and the second upper limit.

[0141] The resource space quantity refers to the total amount of resource space possessed by a physical machine. For example, if physical machine 1 has 2 resource spaces, then the resource space quantity corresponding to physical machine 1 is 2. The first upper limit characterizes the upper limit of virtual machine specifications that can be created in a physical machine when creating virtual machines based on the minimum resource space information and the number of resource spaces. The first upper limit characterizes the upper limit of virtual machine planning that can be created in a physical machine when creating virtual machines based on the maximum resource space information.

[0142] Specifically, the scheduling device can calculate the upper limit of virtual machine creation size for each physical machine in the same cluster. For any physical machine in the cluster, the scheduling device determines the minimum and maximum space resource information from the remaining space resource information of each resource space after allocating virtual machines. Different resource spaces can cooperate to create a virtual machine. The minimum space resource information is used to determine the maximum size of virtual machines that can be created through the cooperation of resource spaces. Therefore, the scheduling device can determine a first upper limit based on the minimum space resource information and the number of resource spaces. For example, the product of the minimum space resource information and the number of resource spaces can be used as the first upper limit. Of course, resource spaces can also create virtual machines independently. The maximum space resource information is used to determine the maximum size of virtual machines that a resource space can create on its own. Therefore, the scheduling device can determine a second upper limit based on the maximum space resource information. For example, the maximum space resource information can be used as the second upper limit. Finally, the scheduling device determines the upper limit of virtual machine creation size for the physical machines in the cluster from the first and second upper limits. For example, the maximum value between the first and second upper limits can be used as the upper limit of virtual machine creation size for the physical machine.

[0143] For example, referring to Figure 5, there are two physical machines, each with 16 CPU cores remaining. Each physical machine has two resource spaces. Resource space 1 on physical machine 1 has 4 CPU cores remaining, and resource space 2 on physical machine 1 has 12 CPU cores remaining. Resource space 1 on physical machine 2 has 8 CPU cores remaining, and resource space 2 on physical machine 2 also has 8 CPU cores remaining. To ensure the memory access performance of virtual machines, they are generally created using CPUs from the same resource space. However, if one resource space cannot meet the needs of the virtual machine, the CPUs required by the virtual machine will be evenly distributed between the two resource spaces, accepting a certain degree of performance loss, and creating virtual machines using CPUs from both resource spaces. When the two resource spaces can cooperate to create the same virtual machine, physical machine 1 can create a maximum of 8-core virtual machines, and physical machine 2 can create a maximum of 16-core virtual machines. That is, the first upper limit for physical machine 1 is 8 cores, and the first upper limit for physical machine 2 is 16 cores. When creating virtual machines within a single resource space, physical machine 1 can create a maximum of 12-core virtual machines, and physical machine 2 can create a maximum of 8-core virtual machines. This means that the second maximum limit for physical machine 1 is 12 cores, and the second maximum limit for physical machine 2 is 8 cores. Therefore, physical machine 1 can create a maximum of 12-core virtual machines, and physical machine 2 can create a maximum of 16-core virtual machines. The maximum virtual machine creation size for physical machine 1 is 12 cores, and the maximum virtual machine creation size for physical machine 2 is 16 cores.

[0144] In the above embodiments, a first upper limit is determined based on the minimum remaining space resource information and the number of resource spaces of the physical machine. The first upper limit can reflect the upper limit of the specifications of virtual machines created by the physical machine across resource spaces. A second upper limit is determined based on the maximum remaining space resource information of the physical machine. The second upper limit can reflect the upper limit of the specifications of virtual machines created by the physical machine in a single resource space. From the first upper limit and the second upper limit, the upper limit of the virtual machine creation specifications corresponding to the physical machine in the cluster is determined. Thus, the upper limit of the virtual machine creation specifications is the optimal result among the two virtual machine creation methods. Such an upper limit of the virtual machine creation specifications helps to further improve resource utilization.

[0145] In one embodiment, the scheduling priority of the physical machine cluster to be sorted is determined based on the upper limit of the virtual machine creation size corresponding to each physical machine in the cluster, including:

[0146] The maximum virtual machine creation size limit is determined from the virtual machine creation size limits corresponding to each physical machine in the cluster;

[0147] Based on the maximum virtual machine creation size limit, determine the scheduling priority of the physical machine clusters to be sorted.

[0148] Specifically, the physical machine cluster to be sorted comprises multiple physical machines. After calculating the upper limit of virtual machine creation specifications for each physical machine, the scheduling device further extracts the maximum value from these upper limits to obtain the maximum upper limit of virtual machine creation specifications. Based on this maximum upper limit, the scheduling priority for the physical machine cluster to be sorted is determined. For example, the maximum upper limit of virtual machine creation specifications is used as the scheduling priority for the physical machine cluster to be sorted. It is understandable that different physical machine clusters to be sorted, if they have different maximum upper limits of virtual machine creation specifications, will have different scheduling priorities.

[0149] In the above embodiments, the maximum virtual machine creation specification limit is determined from the virtual machine creation specification limit limits corresponding to each physical machine in the cluster. Based on the maximum virtual machine creation specification limit, the scheduling priority corresponding to the physical machine cluster to be sorted is determined. This can quickly determine the scheduling priority, and the scheduling priority can reflect the maximum specification of virtual machines that the physical machines in the cluster can accommodate.

[0150] In one embodiment, determining the candidate physical machine for the current virtual machine from the candidate physical machine cluster includes:

[0151] From the candidate physical machine cluster, physical machines with the same idle resource information are divided into master physical machines and slave physical machines;

[0152] From all physical machines in the candidate physical machine cluster except for the slave physical machine, determine the candidate physical machine corresponding to the current virtual machine;

[0153] Based on the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocated physical machine, each reference physical machine cluster is obtained, including:

[0154] Based on the resource demand information corresponding to the last virtual machine, the idle resource information corresponding to each candidate allocated physical machine in the candidate physical machine cluster corresponding to the last virtual machine is updated to obtain each first reference physical machine cluster.

[0155] In the first reference physical machine cluster, the virtual machine allocation results corresponding to the master physical machine are exchanged with the virtual machine allocation results corresponding to the slave physical machines to obtain each second reference physical machine cluster.

[0156] Each reference physical machine cluster is obtained based on each first reference physical machine cluster and each second reference physical machine cluster.

[0157] Among them, the master physical machine and the slave physical machine have the same idle resource information. The master physical machine is the physical machine that needs to perform resource scheduling in real time, and the slave physical machine is the physical machine that needs to reuse the resource scheduling results of the master physical machine.

[0158] Specifically, in order to reduce computational pressure and improve efficiency, when performing resource scheduling, the scheduling device can merge physical machines with the same idle resource information into the same group, and the virtual machine allocation results of each physical machine in the same group can be reused.

[0159] When determining the candidate physical machine for the current virtual machine from the candidate physical machine cluster, the scheduling device divides the physical machines with the same idle resource information into master and slave physical machines. It then selects one physical machine from these master machines and designates the others as slave machines. Since the master and slave physical machines have the same idle resource information, when scheduling the current virtual machine, only the master physical machine needs data analysis to determine whether to allocate it. The slave physical machines do not need to undergo repeated data analysis and can directly reuse the master physical machine's data analysis results. Therefore, in the candidate physical machine cluster, the scheduling device determines the candidate physical machine for the current virtual machine from all physical machines in the cluster except for the slave machines, and selects the physical machine that can accommodate the current virtual machine as the candidate physical machine. Subsequently, a reference physical machine for the current virtual machine is determined from the candidate physical machines. Based on the resource requirements of the current virtual machine, the reference physical machine is updated to obtain the intermediate physical machine cluster for the current virtual machine.

[0160] It is understandable that when scheduling resources for any virtual machine, physical machines with the same idle resource information can be divided into master physical machines and slave physical machines corresponding to the master physical machines. Only data analysis needs to be performed on the master physical machine to determine whether the current virtual machine should be allocated to the master physical machine. The slave physical machines do not need to perform repeated data analysis (such as calculating the fragmentation of the physical machine cluster). In the end, the data analysis results of the master physical machine can be directly reused.

[0161] After obtaining the candidate physical machines corresponding to the last virtual machine, the scheduling device obtains several first reference physical machine clusters based on the candidate physical machines and the candidate physical machine clusters corresponding to the last virtual machine. The first reference physical machine clusters are reference physical machine clusters obtained based on the primary physical machine. Within the first reference physical machine clusters, the virtual machine allocation results corresponding to the primary physical machine are exchanged with the virtual machine allocation results corresponding to the corresponding secondary physical machines to obtain several second reference physical machine clusters. Finally, based on the first and second reference physical machine clusters, several reference physical machine clusters are obtained.

[0162] Referring to Figure 6 as an example, the initial physical machine cluster consists of 4 physical machines. Physical machine 1 has 8 idle cores, physical machine 2 has 8 idle cores, physical machine 3 has 8 idle cores, and physical machine 4 has 6 idle cores. The virtual machines to be created include virtual machine A and virtual machine B. Virtual machine A requires 4 cores, and virtual machine B requires 8 cores.

[0163] First, virtual machine A is designated as the current virtual machine. The candidate physical machine cluster corresponding to virtual machine A includes physical machine 1, physical machine 2, physical machine 3, and physical machine 4. The remaining CPU cores of physical machines 1, 2, 3, and 4 are 8 cores, 8 cores, 8 cores, and 6 cores, respectively. Physical machines 1, 2, 3, and 4 can all accommodate virtual machine A. Since physical machines 1, 2, and 3 have the same number of remaining CPU cores, they can be merged into the same group for reuse. If physical machine 1 is designated as the master physical machine, then physical machines 2 and 3 are slave physical machines. Only the reference allocation physical machine corresponding to the current virtual machine needs to be determined from physical machines 1 and 4; the final reference allocation physical machine for the current virtual machine is physical machine 1. Virtual machine A is then assigned to physical machine 1, resulting in the intermediate physical machine cluster corresponding to physical machine A. The intermediate physical machine cluster corresponding to physical machine A includes physical machine 1, physical machine 2, physical machine 3, and physical machine 4. The remaining CPU cores of physical machine 1, physical machine 2, physical machine 3, and physical machine 4 are 4 cores, 8 cores, 8 cores, and 6 cores, respectively.

[0164] After allocating virtual machine A, virtual machine B is selected as the current virtual machine. The candidate physical machine cluster corresponding to virtual machine B includes physical machine 1, physical machine 2, physical machine 3, and physical machine 4. The remaining CPU cores of physical machines 1, 2, 3, and 4 are 4, 8, 8, and 6 cores, respectively. Only physical machines 2 and 3 can accommodate virtual machine A. Physical machines 2 and 3 have the same number of remaining CPU cores and can be merged into the same group for reuse. If physical machine 2 is designated as the master physical machine, then physical machine 3 is designated as the slave physical machine. Virtual machine B is allocated to physical machine 2, resulting in the first reference physical machine cluster. In the first reference physical machine cluster, the remaining CPU cores of physical machines 1, 2, 3, and 4 are 4, 0, 8, and 6 cores, respectively.

[0165] For virtual machine B, in the first reference physical machine cluster, the virtual machine allocation results of physical machine 2 and physical machine 3 are exchanged to obtain the second reference physical machine cluster. In the second reference physical machine cluster, the remaining number of CPU cores of physical machine 1, physical machine 2, physical machine 3 and physical machine 4 are 4 cores, 8 cores, 0 cores and 6 cores respectively.

[0166] For virtual machine A, in the first reference physical machine cluster, the virtual machine allocation results of physical machine 1 and physical machine 2 are swapped to obtain the second reference physical machine cluster. In the second reference physical machine cluster, the remaining CPU cores of physical machines 1, 2, 3, and 4 are 0 cores, 4 cores, 8 cores, and 6 cores, respectively. In the first reference physical machine cluster, the virtual machine allocation results of physical machine 1 and physical machine 3 are swapped to obtain the second reference physical machine cluster. In the second reference physical machine cluster, the remaining CPU cores of physical machines 1, 2, 3, and 4 are 8 cores, 0 cores, 4 cores, and 6 cores, respectively. In the first reference physical machine cluster, the virtual machine allocation results of physical machines 2 and 3 are swapped first, and then the virtual machine allocation results of physical machines 1 and 2 are swapped again to obtain the second reference physical machine cluster. In the second reference physical machine cluster, the remaining CPU cores of physical machines 1, 2, 3, and 4 are 8 cores, 4 cores, 0 cores, and 6 cores, respectively. In the first reference physical machine cluster, the virtual machine allocation results of physical machine 2 and physical machine 3 are exchanged first, and then the virtual machine allocation results of physical machine 1 and physical machine 3 are exchanged to obtain the second reference physical machine cluster. In the second reference physical machine cluster, the remaining CPU cores of physical machine 1, physical machine 2, physical machine 3 and physical machine 4 are 0 cores, 8 cores, 4 cores and 6 cores respectively.

[0167] In the above embodiments, the resource scheduling results between physical machines with the same idle resource information are actually consistent. Therefore, merging them into the same group and reusing the results can effectively reduce the amount of computation and improve the efficiency of resource scheduling.

[0168] In one embodiment, the resource scheduling method further includes:

[0169] When the initial physical machine cluster is a distributed cluster, the step of determining the current virtual machine from multiple virtual machines is executed.

[0170] Distributed clusters refer to physical machine clusters consisting of multiple physical machines distributed across dispersed locations.

[0171] Specifically, after obtaining the virtual machine demand information for the initial physical machine cluster, the scheduling device first determines whether the initial physical machine cluster is a distributed cluster. If the initial physical machine cluster is a distributed cluster, the final scheduling scheme corresponding to the virtual machine demand information is determined using the method of this application. If the initial physical machine cluster is not a distributed cluster, the final scheduling scheme corresponding to the virtual machine demand information can be determined using either the method of this application or a traditional method. A traditional method could be resource scheduling using a greedy strategy.

[0172] If the initial physical machine cluster is a distributed cluster, then proceed to the step of determining the current virtual machine from multiple virtual machines to obtain the candidate physical machine corresponding to the last virtual machine. Based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate physical machine, each reference physical machine cluster is obtained. From each reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is determined.

[0173] It is understandable that in a distributed scenario, servers (i.e., physical machines) are distributed in clusters across different geographical locations to provide local near-field services. However, distributed server nodes differ from server nodes in a cloud center. The total amount of resources in a distributed cluster is usually a fixed and finite quantity. Traditional resource scheduling methods can easily generate a large number of resource fragments. However, the resource scheduling method described in this application can effectively avoid or reduce the generation of resource fragments and improve resource utilization.

[0174] In the above embodiments, when the initial physical machine cluster is a distributed cluster, resource scheduling using the method of this application can improve the resource utilization of the distributed cluster.

[0175] In one embodiment, the resource scheduling method further includes:

[0176] If the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is smaller than the preset size, proceed to the step of determining the current virtual machine from multiple virtual machines.

[0177] The cluster size of the physical machine cluster reflects its overall size. The cluster size can be determined based on at least one set of data, such as the number of physical machines or the total resources available on those machines. The preset size is a threshold value pre-set for the cluster size. The preset size can be set according to actual needs. For example, the preset size could be set to 10 physical machines.

[0178] Specifically, after obtaining the virtual machine demand information for the initial physical machine cluster, the scheduling device first determines whether the initial physical machine cluster is a distributed cluster. If the initial physical machine cluster is a distributed cluster, it can further analyze the cluster size and compare it with a preset size. If the cluster size is smaller than the preset size, the final scheduling scheme corresponding to the virtual machine demand information is determined using the method of this application. If the cluster size is greater than or equal to the preset size, the final scheduling scheme can be determined using either the method of this application or a traditional method. In other words, when the initial physical machine cluster is a small distributed cluster, the final scheduling scheme corresponding to the virtual machine demand information is determined using the method of this application; when the initial physical machine cluster is a large distributed cluster, the final scheduling scheme can be determined using either the method of this application or a traditional method. If the initial physical machine cluster is not a distributed cluster, the final scheduling scheme can be determined using either the method of this application or a traditional method.

[0179] If the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is less than the preset size, then proceed to the step of determining the current virtual machine from multiple virtual machines to obtain the candidate physical machine corresponding to the last virtual machine. Based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate physical machine, each reference physical machine cluster is obtained. From each reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is determined.

[0180] It is understandable that resource scheduling can be performed using the method described in this application in order to improve the resource utilization of small distributed clusters.

[0181] In the above embodiments, when the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is smaller than the preset size, the resource utilization rate of the small distributed cluster can be improved.

[0182] In a specific embodiment, this application can be applied to a distributed cloud scenario for binning and scheduling virtual machines. In a distributed cloud scenario, servers are distributed in clusters across different geographical locations to provide local near-field services. However, unlike cloud centers, the total amount of resources in a distributed cloud is typically a fixed and finite quantity. Because of this limited resource quantity, arranging resources using the binning method employed in cloud centers (using a greedy algorithm) will inevitably result in a large amount of resource fragmentation. Furthermore, in a distributed cloud scenario, the underlying IaaS (Infrastructure as a Service) and PaaS (Platform as a Service) resources required for cluster management need to be pre-built during deployment. This resource deployment is predetermined and generally does not change after the cluster is built. Therefore, to address the resource fragmentation caused by binning methods during production virtual machine deployment, this application proposes a predictable resource optimization scheduling method for distributed cloud scenarios, improving overall resource utilization by reducing resource fragmentation.

[0183] Referring to Figure 7, customers requiring cloud services can apply for virtual machines through the cloud API provided by the cloud service provider, and can deploy their own services through virtual machines. If a customer applies for a virtual machine, the cloud service provider's dispatcher will merge tasks (i.e., requests) for the same physical machine cluster, and uniformly schedule multiple tasks for the same physical machine cluster to a single scheduler. The scheduler will then perform dynamic planning to obtain the optimal scheduling scheme.

[0184] Because of the limited cluster size in a distributed cloud, customers' requirements for scheduling performance are far lower than those for scheduling quality. The traditional scheduler, where multiple processes compete for control, can actually lead to lock abuse in small clusters, failing to fully utilize physical machine resources. Therefore, this application's method adjusts the overall scheduling architecture. In a distributed cloud environment, scheduling within a single cluster is routed to only a single scheduler, releasing the distributed locks on the physical machines.

[0185] Refer to Figure 8 to illustrate the dynamic programming process. The initial state represents a multi-dimensional array of physical machines, with each dimension representing one physical machine. For simplicity, we take two physical machines as an example, which is a two-dimensional array representing physical machine 1 and physical machine 2 respectively. dp[0] represents the initial state where no virtual machines have been created on the physical machine. Then, based on the specification requirement of the first virtual machine, which is assumed to be 2, we traverse this two-dimensional array from the larger index to the smaller index (the maximum value of the array represents the remaining available resources of the physical machine. The process of scheduling the virtual machine to the physical machine is the maximum value of the physical machine minus the resource value required by the virtual machine). We can obtain that only two corresponding arrays have valid values, which represent placing the virtual machine on physical machine 1 and physical machine 2 respectively. At the same time, we will get the resource fragmentation values ​​corresponding to the two physical machines. The derived state is to continue to install the current virtual machine from the previous dp[i-1] array after the previous virtual machine is installed. At the same time, the resource fragmentation value will also be calculated. Finally, after all the virtual machines in the sequence have completed the calculation, the one with the smallest fragmentation value in the final dp array is the optimal scheduling bin packing result.

[0186] The recurrence relation for dynamic programming is as follows: dp(i,j,k)=min(dp(i-1,j+c,k)+cost(j),dp(i-1,j,k+c)+cost(k))

[0187] Where i represents the virtual machine number, j represents the remaining resources of the first host machine (i.e., the physical machine), k represents the remaining resources on the second host machine, and c represents the resource value required by the i-th virtual machine. The value of dp(i,j,k) represents the minimum resource fragmentation value obtainable for the i-th virtual machine when the capacity of the first host machine is j and the capacity of the second host machine is k. cost(j) represents the resource fragmentation value generated by allocating the i-th virtual machine to the first host machine. cost(j) represents the resource fragmentation value generated by allocating the i-th virtual machine to the second host machine. dp(i-1,j+c,k)+cost(j) represents the total resource fragmentation value generated by allocating the i-th virtual machine to the first host machine based on the allocation results of i-1 virtual machines. dp(i-1,j,k+c)+cost(k) represents the total resource fragmentation value generated by allocating the i-th virtual machine to the second host machine based on the allocation results of i-1 virtual machines.

[0188] Referring to Figure 9, during dynamic programming, resource scheduling efficiency can be improved through various strategies. One is to group remaining physical machines of the same specifications together, as their bin packing results are essentially identical, thus reusing the results. Another strategy is to calculate the expected maximum fragmentation value midway and delete branches with high fragmentation values. The strategy for deleting branches where the current fragmentation sum exceeds the expected maximum value is: current fragmentation sum ≥ minimum fragmentation sum + number of remaining slave machines. For example, if the remaining resources of the master machine are less than 4 cores, resource fragmentation occurs. Taking slave machine A (i.e., virtual machine A) as an example, if slave machine A is assigned to master machine 1, the remaining resources of master machines 1, 2, 3, and 4 in the master machine cluster are 4 cores, 8 cores, 8 cores, and 6 cores respectively. None of the master machines generate fragmentation, thus the current fragmentation sum of the master machine cluster is 0. If slave machine A is assigned to master machine 4, the remaining resources for master machines 1, 2, 3, and 4 in the master machine cluster are 8 cores, 8 cores, 8 cores, and 2 cores respectively. Master machine 4 generates 2 resource fragments, and the current fragmentation of the master machine cluster is 2. At this time, the minimum fragmentation among all allocation schemes is 0. The remaining slave machines include slave machine B and slave machine C, and the number of remaining slave machines is 2. The current expected maximum fragmentation value is 2. If slave machine A is assigned to master machine 4, the current fragmentation of the master machine cluster is greater than or equal to the expected maximum fragmentation value. Therefore, this allocation method should be discarded, and slave machine A should not be assigned to master machine 4.

[0189] Furthermore, after all submachines have been allocated, if multiple packing schemes have the same fragmentation, the maximum machine size that can be produced by the remaining NUMA node resources of each packing scheme can be calculated, and the packing scheme that can produce larger machines will have higher priority.

[0190] Referring to Figure 10, predictable resources in a distributed cloud cluster typically fall into two categories: one is providing an expected resource catalog, essentially a list of resource specifications and quantities; the other is initiating multiple virtual machine creation requests simultaneously within a short period. Both scenarios can trigger the optimal binning scheduling strategy of this application. Upon receiving a resource request from a resource user (i.e., a client), the scheduling binning device (i.e., the scheduling unit) first determines whether the requested cluster information indicates a distributed cloud resource. If it is, a single scheduler is assigned as the scheduler for this batch. Then, it obtains a list of physical machines in the distributed cloud cluster and a binning filter list. Based on the resource request, the physical machine list is filtered using the binning filter list to obtain a list of physical machines that meet the requirements. The binning filter list includes binning filters arranged in order; typically, one binning filter is used to filter a specific type of condition. For example, there are quota filters that check if the remaining CPU and memory of the physical machine meet the needs of the virtual machine; network filters that filter out physical machines that do not meet the network requirements of the virtual machine, including both virtual and physical networks; pool filters, where pools are divided into 1:1 pools and CPU hyper-threading pools; and there are also packing filters for racks, slots, availability zones, etc. All of these packing filters are based on hard criteria; physical machines that do not meet any of these criteria will be eliminated. After selecting a list of physical machines that meet the criteria, the dynamic programming algorithm described earlier is used to derive the optimal packing scheduling scheme between the virtual machine and the physical machine. Then, virtual machine packing configuration files are generated for each virtual machine, specifying the physical CPU to which the virtual machine's CPU is bound. These virtual machine packing configuration files are then distributed in parallel to the corresponding physical machines, enabling the physical machines to execute the corresponding virtual machine creation tasks and polling the creation results. Upon receiving a virtual machine creation task, the physical machine returns a task ID to the scheduling packing device. The scheduling packing device can then query the task status of the virtual machine creation task based on the task ID, indicating whether the virtual machine creation is complete. After all virtual machines have been created, the scheduling and packing device returns the virtual machine creation results to the resource user.

[0191] In summary, the method presented in this application effectively reduces computational complexity, improves the execution efficiency of the scheduling algorithm, and quickly eliminates unnecessary paths through various optimization strategies, thereby focusing on more valuable scheduling schemes and ultimately achieving a rapid production scheduling strategy. This method effectively improves resource utilization, reducing fragmentation rates to below the average level of public clouds and traditional solutions through unified scheduling of predictable resources. Referring to Figure 11, according to test results, the fragmentation rate of the distributed cloud cluster was reduced to 4.6%. Furthermore, this method effectively distinguishes between centralized cloud and distributed cloud scenarios, using a separate scheduler for scheduling in the distributed cloud scenario, avoiding resource contention in distributed cloud environments with multiple schedulers.

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

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

[0194] In one embodiment, as shown in FIG12, a resource scheduling device is provided, including: a demand information acquisition module 1202, a virtual machine screening module 1204, a physical machine screening module 1206, and a scheduling scheme determination module 1208, wherein:

[0195] The requirement information acquisition module 1202 is used to acquire virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to the multiple virtual machines to be created.

[0196] The virtual machine filtering module 1204 is used to determine the current virtual machine from multiple virtual machines and to use the initial physical machine cluster as the candidate physical machine cluster corresponding to the current virtual machine.

[0197] The physical machine screening module 1206 is used to determine at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster. Based on the idle resource information corresponding to the at least one candidate physical machine and the demand resource information corresponding to the current virtual machine, it predicts the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine.

[0198] The physical machine filtering module 1206 is also used to determine the reference allocation physical machine corresponding to the current virtual machine from each candidate allocation physical machine based on the fragmentation amount of the physical machine cluster and the number of remaining virtual machines, and to update the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster based on the resource demand information corresponding to the current virtual machine, so as to obtain each intermediate physical machine cluster corresponding to the current virtual machine.

[0199] The virtual machine filtering module 1204 is also used to take the intermediate physical machine cluster as the candidate physical machine cluster corresponding to the next virtual machine, take the next virtual machine as the current virtual machine, and return to the step of determining at least one candidate allocation physical machine corresponding to the current virtual machine from the candidate physical machine cluster, until the candidate physical machine cluster and each candidate allocation physical machine corresponding to the last virtual machine are obtained.

[0200] The scheduling scheme determination module 1208 is used to obtain each reference physical machine cluster based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate allocation physical machine, and to determine the final scheduling scheme corresponding to the virtual machine requirement information from each reference physical machine cluster. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

[0201] In one embodiment, the physical machine screening module 1206 is further configured to:

[0202] From the candidate physical machine cluster, select physical machines whose idle resource information is greater than or equal to the resource demand information corresponding to the current virtual machine, and use them as candidate physical machines for allocation to the current virtual machine.

[0203] In one embodiment, the physical machine screening module 1206 is further configured to:

[0204] For any candidate physical machine to be allocated, update the available resource information of the candidate physical machine based on the resource demand information of the current virtual machine.

[0205] When the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to the first fragment quantity;

[0206] When the updated idle resource information is not empty and is less than or equal to the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to the second fragment quantity that matches the updated idle resource information; the first fragment quantity is less than the second fragment quantity.

[0207] Based on the current physical machine fragmentation of each physical machine in the candidate physical machine cluster, the physical machine cluster fragmentation generated by allocating the current virtual machine to the candidate physical machine is obtained.

[0208] In one embodiment, the physical machine screening module 1206 is further configured to:

[0209] Determine the minimum fragmentation amount from the fragmentation amounts of each physical machine cluster;

[0210] The physical machine cluster fragmentation threshold is obtained based on the minimum fragmentation amount and the number of remaining virtual machines;

[0211] The candidate physical machines corresponding to the fragmentation amount of the physical machine cluster that is smaller than the physical machine cluster fragmentation threshold are used as the reference physical machines for the current virtual machine.

[0212] In one embodiment, the scheduling scheme determination module 1208 is further configured to:

[0213] Based on the amount of physical machine cluster fragments corresponding to each reference physical machine cluster, the final reference physical machine cluster is determined from each reference physical machine cluster.

[0214] Based on the final reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is obtained.

[0215] In one embodiment, the scheduling scheme determination module 1208 is further configured to:

[0216] From all the reference physical machine clusters, select the one with the smallest fragmentation as the final reference physical machine cluster.

[0217] In one embodiment, the scheduling scheme determination module 1208 is further configured to:

[0218] From each reference physical machine cluster, multiple reference physical machine clusters that each have the smallest physical machine cluster fragmentation are selected as physical machine clusters to be sorted.

[0219] For any physical machine cluster to be sorted, based on the remaining space resources of each physical machine in the cluster after allocating virtual machines, determine the upper limit of virtual machine creation specifications for the physical machines in the cluster, and determine the scheduling priority of the physical machine cluster to be sorted based on the upper limit of virtual machine creation specifications for each physical machine in the cluster.

[0220] Based on scheduling priority, the final reference physical machine cluster is determined from each unordered physical machine cluster.

[0221] In one embodiment, the scheduling scheme determination module 1208 is further configured to:

[0222] For any physical machine in the cluster, determine the minimum and maximum space resource information from the remaining space resource information of each resource space of the physical machine after allocating virtual machines;

[0223] A first upper limit is determined based on the minimum spatial resource information and the amount of resource space, and a second upper limit is determined based on the maximum spatial resource information.

[0224] Determine the upper limit of virtual machine creation specifications corresponding to physical machines in the cluster from the first upper limit and the second upper limit.

[0225] In one embodiment, the scheduling scheme determination module 1208 is further configured to:

[0226] The maximum virtual machine creation size limit is determined from the virtual machine creation size limits corresponding to each physical machine in the cluster;

[0227] Based on the maximum virtual machine creation size limit, determine the scheduling priority of the physical machine clusters to be sorted.

[0228] In one embodiment, the physical machine screening module 1206 is further configured to:

[0229] From the candidate physical machine cluster, physical machines with the same idle resource information are divided into master physical machines and slave physical machines; from the physical machines in the candidate physical machine cluster excluding slave physical machines, the candidate allocation physical machine corresponding to the current virtual machine is determined.

[0230] The scheduling scheme determination module 1208 is also used for:

[0231] Based on the resource demand information corresponding to the last virtual machine, the idle resource information corresponding to each candidate physical machine in the candidate physical machine cluster corresponding to the last virtual machine is updated to obtain each first reference physical machine cluster; in the first reference physical machine cluster, the virtual machine allocation result corresponding to the master physical machine is exchanged with the virtual machine allocation result corresponding to the corresponding slave physical machine to obtain each second reference physical machine cluster; based on each first reference physical machine cluster and each second reference physical machine cluster, each reference physical machine cluster is obtained.

[0232] In one embodiment, the resource scheduling device is further configured to:

[0233] When the initial physical machine cluster is a distributed cluster, the step of determining the current virtual machine from multiple virtual machines is executed.

[0234] In one embodiment, the resource scheduling device is further configured to:

[0235] If the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is smaller than the preset size, proceed to the step of determining the current virtual machine from multiple virtual machines.

[0236] The aforementioned resource scheduling device acquires virtual machine demand information for the initial physical machine cluster. This demand information includes the resource requirements of each virtual machine to be created. Based on this demand information, it determines the physical machines corresponding to each virtual machine from the initial physical machine cluster, thus obtaining the final scheduling scheme. Specifically, it identifies the current virtual machine from among the multiple virtual machines, uses the initial physical machine cluster as the candidate physical machine cluster for the current virtual machine, and selects physical machines capable of accommodating the current virtual machine from the candidate cluster as candidate allocation physical machines. Based on the idle resource information of the candidate allocation physical machines and the resource requirements of the current virtual machine, it predicts the amount of physical machine cluster fragmentation that would result from allocating the current virtual machine to each candidate allocation physical machine. Based on the amount of physical machine cluster fragmentation and the number of remaining virtual machines, it further filters out unsuitable candidate allocation physical machines from the candidate allocation physical machines, obtaining the reference allocation physical machine for the current virtual machine. In this way, by pre-filtering scheduling schemes unsuitable for further allocation of remaining virtual machines based on the amount of physical machine cluster fragmentation and the number of remaining virtual machines, it can not only effectively improve the resource utilization of physical machines and avoid resource waste caused by excessive resource fragmentation in the final scheduling scheme, but also effectively reduce the workload of subsequent allocation and improve resource scheduling efficiency. Based on the resource requirements of the current virtual machine, the idle resource information of each reference allocated physical machine in the candidate physical machine cluster is updated to obtain the intermediate physical machine clusters corresponding to the current virtual machine. Each intermediate physical machine cluster can indicate various feasible scheduling schemes for the current virtual machine. The intermediate physical machine clusters are used as candidate physical machine clusters for the next virtual machine, and the next virtual machine is used as the current virtual machine. The above steps are repeated to determine the intermediate physical machine clusters corresponding to the next virtual machine, and so on, until the candidate physical machine cluster and candidate allocated physical machine corresponding to the last virtual machine (i.e., the last virtual machine) are obtained. Based on the candidate allocated physical machines and candidate physical machine clusters corresponding to the last virtual machine, each reference physical machine cluster is obtained. In this way, the next virtual machine is allocated based on the various feasible scheduling schemes of the current virtual machine, which can determine multiple feasible scheduling schemes from multiple perspectives, which helps to improve the resource utilization of physical machines. Furthermore, the various feasible scheduling schemes of the last virtual machine naturally include the allocation methods of the previous virtual machines, so the final scheduling scheme can be determined through the various feasible scheduling schemes of the last virtual machine. In summary, during resource scheduling, the allocation method for each virtual machine is determined sequentially, and the feasible allocation method for the next virtual machine is determined based on the feasible allocation methods of the current virtual machine, thus achieving dynamic allocation and ensuring the resource utilization of the final allocation method. Furthermore, when determining the feasible allocation method for a single virtual machine, allocation methods that are not suitable for continuing to allocate the remaining virtual machines are filtered out in advance, which can further improve resource utilization and resource scheduling efficiency.

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

[0238] In one embodiment, a computer device, which may be a server, is provided, and its internal structure is shown in Figure 13. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage media. The database of the computer device stores data related to resource scheduling methods. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection. When the computer-readable instructions are executed by the processor, a resource scheduling method is implemented.

[0239] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram is shown in Figure 14. The computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer-readable instructions. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium. The input / output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer-readable instructions are executed by the processor, a resource scheduling method is implemented. The display unit of the computer device is used to form a visually visible image and may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0240] Those skilled in the art will understand that the structures shown in Figures 13 and 14 are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements.

[0241] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing computer-readable instructions, the processor executing the computer-readable instructions to implement the steps in the above method embodiments.

[0242] In one embodiment, a computer-readable storage medium is provided storing computer-readable instructions that, when executed by a processor, implement the steps in the above method embodiments.

[0243] In one embodiment, a computer program product is provided, the computer program product including computer-readable instructions that, when executed by a processor, implement the steps in the above method embodiments.

[0244] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

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

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

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

Claims

1. A resource scheduling method, characterized in that, The method includes: Obtain virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to each of the multiple virtual machines to be created; The current virtual machine is determined from the plurality of virtual machines, and the initial physical machine cluster is used as the candidate physical machine cluster corresponding to the current virtual machine. Determine at least one candidate physical machine for the current virtual machine from the candidate physical machine cluster. Based on the idle resource information corresponding to the at least one candidate physical machine and the demand resource information corresponding to the current virtual machine, predict the amount of physical machine cluster fragmentation that will be generated by allocating the current virtual machine to each candidate physical machine. Based on the fragmentation amount of the physical machine cluster and the number of remaining virtual machines, the reference allocation physical machine corresponding to the current virtual machine is determined from each candidate allocation physical machine. Based on the resource demand information corresponding to the current virtual machine, the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster is updated respectively to obtain each intermediate physical machine cluster corresponding to the current virtual machine. The intermediate physical machine cluster is used as the candidate physical machine cluster corresponding to the next virtual machine, and the next virtual machine is used as the current virtual machine. The step of determining at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster is returned to the execution until the candidate physical machine cluster and each candidate physical machine corresponding to the last virtual machine are obtained. Based on the candidate physical machine clusters corresponding to the last virtual machine and each candidate allocation physical machine, each reference physical machine cluster is obtained. From each reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is determined. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

2. The method according to claim 1, characterized in that, The step of determining the candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster includes: From the candidate physical machine cluster, select physical machines whose idle resource information is greater than or equal to the resource demand information corresponding to the current virtual machine, and use them as candidate allocation physical machines for the current virtual machine.

3. The method according to any one of claims 1 to 2, characterized in that, The step of predicting the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine, based on the idle resource information corresponding to the at least one candidate physical machine and the required resource information corresponding to the current virtual machine, includes: For any candidate physical machine to be allocated, update the idle resource information corresponding to the candidate physical machine based on the resource demand information corresponding to the current virtual machine; When the updated idle resource information is empty or greater than the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to the first fragment quantity; When the updated idle resource information is not empty and is less than or equal to the preset idle resource information, the current physical machine fragment quantity of the candidate allocation physical machine is updated to a second fragment quantity that matches the updated idle resource information; the first fragment quantity is less than the second fragment quantity. Based on the current physical machine fragmentation of each physical machine in the candidate physical machine cluster, the physical machine cluster fragmentation generated by allocating the current virtual machine to the candidate physical machine is obtained.

4. The method according to any one of claims 1 to 3, characterized in that, The step of determining the reference physical machine corresponding to the current virtual machine from among the candidate physical machines based on the fragmentation amount and the number of remaining virtual machines in the physical machine cluster includes: Determine the minimum fragmentation amount from the fragmentation amounts of each physical machine cluster; Based on the minimum fragmentation amount and the remaining number of virtual machines, the physical machine cluster fragmentation threshold is obtained; The candidate physical machines corresponding to the physical machine cluster fragmentation amount that is smaller than the physical machine cluster fragmentation threshold are used as the reference physical machines corresponding to the current virtual machine.

5. The method according to any one of claims 1 to 4, characterized in that, The step of determining the final scheduling scheme corresponding to the virtual machine demand information from each of the reference physical machine clusters includes: Based on the amount of physical machine cluster fragments corresponding to each of the reference physical machine clusters, the final reference physical machine cluster is determined from each of the reference physical machine clusters; Based on the final reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is obtained.

6. The method according to any one of claims 1 to 5, characterized in that, The step of determining the final reference physical machine cluster from the various reference physical machine clusters based on the fragmentation amount of each reference physical machine cluster includes: From the various reference physical machine clusters, the reference physical machine cluster with the smallest fragmentation is selected as the final reference physical machine cluster.

7. The method according to any one of claims 1 to 6, characterized in that, The step of determining the final reference physical machine cluster from the various reference physical machine clusters based on the fragmentation amount of each reference physical machine cluster includes: From the various reference physical machine clusters, multiple reference physical machine clusters that each have the smallest number of physical machine cluster fragments are selected as physical machine clusters to be sorted. For any physical machine cluster to be sorted, based on the remaining space resources of each physical machine in the cluster after allocating virtual machines, the upper limit of virtual machine creation specifications corresponding to the physical machine in the cluster is determined, and based on the upper limit of virtual machine creation specifications corresponding to each physical machine in the cluster, the scheduling priority corresponding to the physical machine cluster to be sorted is determined. Based on the scheduling priority, the final reference physical machine cluster is determined from each unordered physical machine cluster.

8. The method according to any one of claims 1 to 7, characterized in that, The method of determining the upper limit of virtual machine creation specifications for each physical machine in the cluster based on the remaining space resources of each physical machine after allocating virtual machines includes: For any physical machine in the cluster, determine the minimum and maximum space resource information from the remaining space resource information of each of the physical machine's resource spaces after allocating virtual machines; Based on the minimum space resource information and the number of resource spaces, a first upper limit is determined, and based on the maximum space resource information, a second upper limit is determined. Determine the upper limit of virtual machine creation specifications corresponding to physical machines in the cluster from the first upper limit and the second upper limit.

9. The method according to any one of claims 1 to 8, characterized in that, The process of determining the scheduling priority of the physical machine cluster to be sorted based on the upper limit of virtual machine creation specifications corresponding to each physical machine in the cluster includes: The maximum virtual machine creation size limit is determined from the virtual machine creation size limits corresponding to each physical machine in the cluster; Based on the maximum virtual machine creation specification limit, the scheduling priority corresponding to the physical machine cluster to be sorted is determined.

10. The method according to any one of claims 1 to 9, characterized in that, The step of determining the candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster includes: From the candidate physical machine cluster, physical machines with the same idle resource information are divided into master physical machines and slave physical machines; From all physical machines in the candidate physical machine cluster except for the slave physical machine, determine the candidate physical machine corresponding to the current virtual machine; The process of obtaining each reference physical machine cluster based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate allocated physical machine includes: Based on the resource demand information corresponding to the last virtual machine, the idle resource information corresponding to each candidate allocated physical machine in the candidate physical machine cluster corresponding to the last virtual machine is updated respectively to obtain each first reference physical machine cluster. In the first reference physical machine cluster, the virtual machine allocation results corresponding to the master physical machine are exchanged with the virtual machine allocation results corresponding to the slave physical machines to obtain each second reference physical machine cluster. Each reference physical machine cluster is obtained based on the first reference physical machine cluster and the second reference physical machine cluster.

11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: When the initial physical machine cluster is a distributed cluster, the step of determining the current virtual machine from the plurality of virtual machines is executed.

12. The method according to any one of claims 1 to 11, characterized in that, The method further includes: When the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is less than a preset size, the step of determining the current virtual machine from the plurality of virtual machines is executed.

13. A resource scheduling device, characterized in that, The device includes: The requirement information acquisition module is used to acquire virtual machine requirement information for the initial physical machine cluster; the virtual machine requirement information includes the resource requirement information corresponding to each of the multiple virtual machines to be created; The virtual machine filtering module is used to determine the current virtual machine from the plurality of virtual machines and to use the initial physical machine cluster as the candidate physical machine cluster corresponding to the current virtual machine. The physical machine filtering module is used to determine at least one candidate physical machine corresponding to the current virtual machine from the candidate physical machine cluster, and based on the idle resource information corresponding to the at least one candidate physical machine and the demand resource information corresponding to the current virtual machine, predict the amount of physical machine cluster fragmentation generated by allocating the current virtual machine to each candidate physical machine. The physical machine filtering module is further configured to determine the reference allocation physical machine corresponding to the current virtual machine from the candidate allocation physical machines based on the fragmentation amount and the number of remaining virtual machines in the physical machine cluster, and update the idle resource information corresponding to each reference allocation physical machine in the candidate physical machine cluster based on the resource demand information corresponding to the current virtual machine, so as to obtain each intermediate physical machine cluster corresponding to the current virtual machine. The virtual machine filtering module is further configured to use the intermediate physical machine cluster as the candidate physical machine cluster corresponding to the next virtual machine, use the next virtual machine as the current virtual machine, and return to the step of determining at least one candidate allocation physical machine corresponding to the current virtual machine from the candidate physical machine cluster, until the candidate physical machine cluster and each candidate allocation physical machine corresponding to the last virtual machine are obtained. The scheduling scheme determination module is used to obtain each reference physical machine cluster based on the candidate physical machine cluster corresponding to the last virtual machine and each candidate allocation physical machine, and to determine the final scheduling scheme corresponding to the virtual machine requirement information from each reference physical machine cluster. The final scheduling scheme is used to instruct the multiple virtual machines to be created to be created in the physical machines in the initial physical machine cluster according to the final reference physical machine cluster.

14. The apparatus according to claim 13, characterized in that, The physical machine screening module is further configured to obtain physical machines from the candidate physical machine cluster whose idle resource information is greater than or equal to the required resource information of the current virtual machine, and use them as candidate allocation physical machines for the current virtual machine.

15. The apparatus according to any one of claims 13 to 14, characterized in that, The physical machine filtering module is further configured to, for any candidate physical machine to be allocated, update the idle resource information corresponding to the candidate physical machine based on the resource demand information corresponding to the current virtual machine; when the updated idle resource information is empty or greater than the preset idle resource information, update the current physical machine fragment quantity of the candidate physical machine to a first fragment quantity; when the updated idle resource information is not empty and is less than or equal to the preset idle resource information, update the current physical machine fragment quantity of the candidate physical machine to a second fragment quantity that matches the updated idle resource information. The number of the first fragment is less than the number of the second fragment; Based on the current physical machine fragmentation of each physical machine in the candidate physical machine cluster, the physical machine cluster fragmentation generated by allocating the current virtual machine to the candidate physical machine is obtained.

16. The apparatus according to any one of claims 13 to 15, characterized in that, The physical machine filtering module is also used to determine the minimum fragmentation amount from the fragmentation amounts of each physical machine cluster; and to obtain the physical machine cluster fragmentation threshold based on the minimum fragmentation amount and the number of remaining virtual machines. The candidate physical machines corresponding to the physical machine cluster fragmentation amount that is smaller than the physical machine cluster fragmentation threshold are used as the reference physical machines corresponding to the current virtual machine.

17. The apparatus according to any one of claims 13 to 16, characterized in that, The scheduling scheme determination module is also used to determine the final reference physical machine cluster from the various reference physical machine clusters based on the physical machine cluster fragmentation amount corresponding to each of the various reference physical machine clusters. Based on the final reference physical machine cluster, the final scheduling scheme corresponding to the virtual machine requirement information is obtained.

18. The apparatus according to any one of claims 13 to 17, characterized in that, The scheduling scheme determination module is also used to select the reference physical machine cluster with the smallest fragmentation from the various reference physical machine clusters as the final reference physical machine cluster.

19. The apparatus according to any one of claims 13 to 18, characterized in that, The scheduling scheme determination module is further configured to select multiple reference physical machine clusters, each having the minimum physical machine cluster fragmentation, as physical machine clusters to be sorted from the various reference physical machine clusters; for any physical machine cluster to be sorted, based on the remaining space resource information of each physical machine in the cluster after allocating virtual machines, determine the upper limit of virtual machine creation specifications corresponding to the physical machine in the cluster, and determine the scheduling priority corresponding to the physical machine cluster to be sorted based on the upper limit of virtual machine creation specifications corresponding to each physical machine in the cluster. Based on the scheduling priority, the final reference physical machine cluster is determined from each unordered physical machine cluster.

20. The apparatus according to any one of claims 13 to 19, characterized in that, The scheduling scheme determination module is also used to determine the minimum and maximum space resource information for any physical machine in the cluster from the remaining space resource information of each of the physical machine's resource spaces after allocating virtual machines; Based on the minimum space resource information and the number of resource spaces, a first upper limit is determined, and based on the maximum space resource information, a second upper limit is determined. Determine the upper limit of virtual machine creation specifications corresponding to physical machines in the cluster from the first upper limit and the second upper limit.

21. The apparatus according to any one of claims 13 to 20, characterized in that, The scheduling scheme determination module is further configured to determine the maximum virtual machine creation specification limit from the virtual machine creation specification limit limits corresponding to each physical machine in the cluster; and determine the scheduling priority corresponding to the physical machine cluster to be sorted based on the maximum virtual machine creation specification limit.

22. The apparatus according to any one of claims 13 to 21, characterized in that, The physical machine filtering module is further configured to divide physical machines with the same idle resource information from the candidate physical machine cluster into master physical machines and slave physical machines; and to determine the candidate allocation physical machine corresponding to the current virtual machine from all physical machines in the candidate physical machine cluster except for the slave physical machines. The scheduling scheme determination module is also used to update the idle resource information of each candidate allocated physical machine in the candidate physical machine cluster corresponding to the last virtual machine based on the required resource information of the last virtual machine, so as to obtain each first reference physical machine cluster. In the first reference physical machine cluster, the virtual machine allocation results corresponding to the master physical machine are exchanged with the virtual machine allocation results corresponding to the slave physical machines to obtain each second reference physical machine cluster. Each reference physical machine cluster is obtained based on the first reference physical machine cluster and the second reference physical machine cluster.

23. The apparatus according to any one of claims 13 to 22, characterized in that, The apparatus is also configured to, when the initial physical machine cluster belongs to a distributed cluster, proceed to the step of determining the current virtual machine from the plurality of virtual machines.

24. The apparatus according to any one of claims 13 to 23, characterized in that, The device is further configured to, when the initial physical machine cluster is a distributed cluster and the cluster size of the initial physical machine cluster is less than a preset size, proceed to the step of determining the current virtual machine from the plurality of virtual machines.

25. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, characterized in that, When the processor executes the computer-readable instructions, it implements the steps of the method according to any one of claims 1 to 12.

26. A computer-readable storage medium storing computer-readable instructions thereon, characterized in that, When the computer-readable instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 12.

27. A computer program product comprising computer-readable instructions, characterized in that, When the computer-readable instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 12.