Resource allocation method, electronic equipment and readable storage medium

By using a two-way matching mechanism to consider the matching results between the resources to be allocated and the physical nodes during the resource allocation process, the problem of unsatisfactory resource allocation results in the existing technology is solved, and more suitable and stable resource allocation is achieved.

CN122044878APending Publication Date: 2026-05-15ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610208249.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-12
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies only consider the demand for resources to be allocated when allocating resources, resulting in poor resource allocation outcomes.

Method used

A bidirectional matching mechanism is adopted to determine the second object that matches the first target object from multiple objects, and to allocate resources when the two match, taking into account the bidirectional matching results of the resources to be allocated and the physical nodes.

Benefits of technology

By using a two-way matching mechanism, a more suitable and stable resource allocation result is obtained, thus solving the problem of unsatisfactory resource allocation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122044878A_ABST
    Figure CN122044878A_ABST
Patent Text Reader

Abstract

The invention discloses a resource allocation method, electronic equipment and a readable storage medium, and belongs to the field of computers. The method comprises the following steps: determining at least one second object matched with a first target object from a plurality of second objects; the first target object is any one of a plurality of first objects; under the condition that the at least one second object comprises a second target object and at least one first object matched with the second target object comprises the first target object, allocating a to-be-allocated resource to a physical node; the second target object is any one second object in the plurality of second objects; wherein the first target object is one of the to-be-allocated resource and the physical node, the second target object is the other one of the to-be-allocated resource and the physical node, and the to-be-allocated resource is a resource operated by the physical node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer science, and specifically relates to a resource allocation method, an electronic device, and a readable storage medium. Background Technology

[0002] Currently, resource allocation is required in many scenarios, such as assigning virtual machines to a physical node. Furthermore, the outcome of resource allocation can affect the energy consumption and operating costs of the physical node, making resource allocation a crucial issue.

[0003] When allocating resources, related technologies typically only consider the resource requirements of the resource to be allocated and assign physical nodes that can meet those requirements. The resource allocation results obtained in this way are unsatisfactory. Summary of the Invention

[0004] This application provides a resource allocation method, an electronic device, and a readable storage medium, which can solve the problem of unsatisfactory resource allocation results obtained by related technologies.

[0005] In a first aspect, embodiments of this application provide a resource allocation method, including: Determine at least one second object from a plurality of second objects that matches the first target object; the first target object is any one of the plurality of first objects; If at least one second object includes a second target object, and at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects. Wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, wherein the resource to be allocated is a resource operated by the physical node.

[0006] In a second aspect, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores a program or instructions, which, when executed by the processor, implement the method described in the first aspect.

[0007] Thirdly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0009] In this embodiment, at least one second object matching a first target object is determined from a plurality of second objects; the first target object is any one of the plurality of first objects; when the at least one second object includes the second target object, and the at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects; wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, and the resource to be allocated is a resource run by the physical node. Thus, when the physical node and the resource to be allocated are mutually matched, the resource to be allocated is allocated to the physical node. Compared to related technologies that only consider the resource requirements of the resource to be allocated, this embodiment uses a bidirectional matching method for resource allocation, fully considering the matching results of both the resource to be allocated and the physical node, thereby obtaining a more suitable resource allocation result and solving the problem of unsatisfactory resource allocation results in related technologies. Attached Figure Description

[0010] Figure 1 This is an example schematic diagram of an implementation environment for a virtual machine allocation method provided in an embodiment of this application; Figure 2 This is a schematic diagram illustrating the placement of a virtual machine according to an embodiment of this application; Figure 3 This is a flowchart of a resource allocation method provided in an embodiment of this application; Figure 4 This is a flowchart of another resource allocation method provided in the embodiments of this application; Figure 5 This is a flowchart of another resource allocation method provided in the embodiments of this application; Figure 6 This is a schematic diagram of a concurrent scheduling method provided in an embodiment of this application; Figure 7 This is a schematic diagram of the generation logic of a queue to be allocated provided in an embodiment of this application; Figure 8 This is a flowchart of another resource allocation method provided in the embodiments of this application; Figure 9 This is a flowchart of another resource allocation method provided in the embodiments of this application; Figure 10 This is a schematic diagram of a stable matching process provided in an embodiment of this application; Figure 11 This is a flowchart illustrating a stable matching process provided in an embodiment of this application; Figure 12 This is a flowchart illustrating a resource allocation method provided in an embodiment of this application; Figure 13 This is a schematic structural block diagram of a resource allocation device provided in an embodiment of this application; Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0011] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0012] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0013] The resource allocation method provided in this application can be specifically applied to allocation techniques such as those for virtual machines waiting for resource allocation. For example, the resource allocation method provided in this application can be applied to virtual machine placement techniques, employing a bidirectional matching mechanism during the resource allocation process to obtain more suitable and stable resource allocation results.

[0014] Taking a virtual machine as an example of the resources to be allocated, the following describes the implementation environment of the resource allocation method provided in this application. (Refer to...) Figure 1 , Figure 1 This is an example schematic diagram illustrating the implementation environment of a virtual machine allocation method provided in this application embodiment. For example... Figure 1 As shown, the resource allocation method provided in this application involves a management device (management host) and multiple physical hosts (such as...). Figure 1 In ... As shown in the figure, the management device may include a virtual machine sequence generation module, a resource scheduling module, and a virtual machine placement module.

[0015] In some examples, the virtual machine sequence generation module determines the virtual machine to be deployed based on virtual machine resource request information (e.g., ...). Figure 1 In , , , ...... As shown, the resource scheduling module is responsible for weighted summation of virtual machines (VMs) to be deployed according to resource scarcity, obtaining the overall dependency of each VM on the resources provided by the physical host. Then, it sorts the VMs according to their dependency, generating a queue for allocation. This facilitates subsequent resource scheduling by prioritizing VMs with high resource dependencies and allocating scarce resources to VMs with strong dependencies on those resources. The resource scheduling module matches each VM with a suitable physical host, obtaining resource matching results (e.g., presented in a bitmap format). These results include the mapping relationship between each VM and the physical host. For example... Figure 1 middle" "Represents virtual machine" , and Assigned to physical host “ "Represents virtual machine" , and Assigned to physical host “ "Represents virtual machine" and Assigned to physical host “ "Represents virtual machine" and Assigned to physical host The virtual machine placement module deploys virtual machines to corresponding physical hosts according to the resource matching results obtained from the resource scheduling module, such as... Figure 1 As shown, the virtual machine and virtual machines Deploy to physical host Above, the virtual machine and virtual machines Deploy to physical host superior.

[0016] In other words, the virtual machine sequence generation module is used to determine the resource scarcity of each type of resource, the resource dependency of each virtual machine, and sort the virtual machines according to their resource dependencies. The resource scheduling module consists of a task dispatcher and a task executor, and the task executor can perform concurrent scheduling across multiple instances. The virtual machine placement module can start virtual machines on physical nodes using the user's desired virtual machine technology (e.g., KVM / Xen / VMware). See also... Figure 2 , Figure 2 This is a schematic diagram illustrating the placement of a virtual machine according to an embodiment of this application. Figure 2 As shown, the virtual machine scheduling module can generate a layout map of virtual machine placement, and the virtual machine placement module can find the corresponding node and start the virtual machine according to the layout map.

[0017] It should be noted that the embodiments of this application are not limited to virtual machine placement, but can also be applied to other resource allocation scenarios, such as deploying applications to physical nodes. Furthermore, the embodiments of this application are not limited to using the physical host as the unit for virtual machine placement; some electronic components within the physical host can also be used as virtual machine placement units to achieve finer-grained resource allocation. For example, for virtual machine performance, Non-Uniform Memory Access (NUMA) affinity placement is often required. In this case, the virtual machine can be assigned to a NUMA node of the physical host. In addition, the resource matching degree, resource dependency degree, and resource scarcity mentioned above are merely examples, and the embodiments of this application are not limited to using this method for resource allocation.

[0018] The resource allocation method provided in this application embodiment can be executed by a target device, wherein the target device can be a single electronic device or multiple electronic devices. That is, the resource allocation method provided in this application embodiment can be executed by a single electronic device, wherein the electronic device can be a terminal device such as a desktop computer, laptop computer, mobile phone, or tablet, or a server, such as a standalone physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing. For example, the target device is, for instance, a... Figure 1 The management device (management host) in the process. When the resource allocation method provided in this application embodiment is executed by multiple electronic devices, these multiple electronic devices can form a service cluster, and they cooperate with each other to complete the various steps.

[0019] The resource allocation method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0020] Please see Figure 3 , Figure 3This is a flowchart of a resource allocation method provided in an embodiment of this application. For example... Figure 3 As shown, the method includes the following steps: Step 310: Determine at least one second object from a plurality of second objects that matches the first target object; the first target object is any one of the plurality of first objects.

[0021] In this embodiment, the first object is one of the resource to be allocated and the physical node, and the second object is the other of the resource to be allocated and the physical node. The resource to be allocated is a resource to be deployed on the physical node, such as a virtual machine. The physical node can be an electronic device or some electronic components within an electronic device. For example, the physical node can be a physical host or a NUMA node. A physical host may include one or more NUMA nodes, and a NUMA node typically includes one or more CPU cores, memory connected to the CPU cores, and input / output (IO) resources connected to the CPU cores. Furthermore, it should be noted that the virtual machine is only one example of the resource to be allocated; the resource to be allocated can also be an application to be deployed. Correspondingly, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, whereby the resource to be allocated is a resource run by the physical node.

[0022] Taking the first target object as an example of a resource to be allocated, at least one physical node matching the resource to be allocated refers to a physical node suitable for deploying the resource to be allocated. Taking the first target object as an example of a physical node, at least one virtual machine matching the physical node refers to a resource to be allocated suitable for deployment on the physical node. In the process of determining at least one second object matching the first target object from a plurality of second objects, at least one second object matching the first target object can be determined from the plurality of second objects based on a first matching degree between the first target object and each of the plurality of second objects.

[0023] However, it should be noted that in this embodiment, the at least one second object matching the first target object is not limited to being determined by the first matching degree, but can also be determined by the change in the proportion of remaining resources of a physical node before and after the deployment of the resource to be allocated. Taking the first target object as the resource to be allocated as an example, the multiple second objects are multiple physical nodes. For any one of the multiple physical nodes, before the resource to be allocated is deployed to the physical node, the proportion of CPU cores, memory, and hard disk resources that the physical node can still provide is a:b:c. If, after the resource to be allocated is deployed to the physical node, the proportion of CPU cores, memory, and hard disk resources that the physical node can still provide is a:b:c or close to a:b:c, it indicates that the resources on the physical node are consumed relatively evenly after the resource to be allocated is allocated to that physical node, and that physical node can be considered as a second object matching the resource to be allocated.

[0024] Step 320: If at least one second object includes a second target object, and at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to the physical node; the second target object is any one of the plurality of second objects.

[0025] In this embodiment, the resource to be allocated is allocated to the physical node only if the resource and the physical node are mutually matched. Furthermore, at least one first object matching the second target object can be determined in the same way as in step 310, where at least one second object matching the first target object is determined. Alternatively, at least one first object matching the second target object can be determined in a different manner.

[0026] To facilitate understanding of the matching mechanism in the embodiments of this application, the following example illustrates the following: Virtual machine 1 is matched with physical nodes 1 and 2, virtual machine 2 is matched with physical node 2, physical node 1 is matched with virtual machines 1 and 2, and physical node 2 is matched with virtual machine 1. In this case, since virtual machine 1 and physical node 1 are mutually matched, virtual machine 1 can be assigned to physical node 1; since physical node 2 does not match virtual machine 2, virtual machine 2 is not assigned to physical node 2 that matches virtual machine 2.

[0027] It is important to understand that in step 320, allocating resources to physical nodes is used to indicate the allocation scheme of distributing resources to physical nodes, not to indicate the direct deployment of resources to physical nodes. In fact, in this embodiment, deployment can be carried out uniformly after all resources have been allocated. This facilitates adjustments to the resource allocation scheme and allows for global coordination of resource allocation.

[0028] In this embodiment, the idea of ​​a stable marriage algorithm is incorporated into the resource allocation process. The following is a brief introduction to the idea of ​​the stable marriage algorithm. The stable marriage algorithm belongs to the bipartite graph algorithm family in graph theory and can achieve a relatively ideal resource matching effect within a predictable time. The original idea of ​​the algorithm is: divide the resources into two parties (two sets), one is the suitor (e.g., the male), and the other is the suitee (e.g., the female). Each member of each party has a queue of each member of the other party, sorted by preference. The suitor actively pursues the suitee. If the suitee finds that the current suitor is better than her existing partner, then the suitee will choose the suitor with higher preference and discard the previous suitor. The discarded suitor will then continue to pursue the next suitor according to her preference queue. In short, the basic idea of ​​the stable marriage algorithm is that one party actively proposes, and the other party chooses based on the best match. In this way, the final matching result will not have a combination where both parties prefer each other and are not matched.

[0029] The following simple example illustrates the stable state in a stable mating algorithm. Assume there are two males: M1 and M2; and two females: F1 and F2. Their preferences for each other are as follows: M1's preference: F1 > F2 (i.e., prefers F1 to F2); M2's preference: F1 > F2; F1's preference: M2 > M1; F2's preference: M1 > M2.

[0030] In this scenario, since M2 prefers F1 and F1 also prefers M2, the combinations (M1, F1) and (M2, F2) are unstable. However, the combinations (M1, F2) and (M2, F1) are stable. Although M1 prefers F1, F1 does not necessarily prefer M1, so M1's preference for F1 is one-sided and cannot alter the (M2, F1) combination. This application's embodiment, by incorporating the idea of ​​a stable marriage matching algorithm, ensures a more stable final resource allocation result and a better match between the two parties.

[0031] In this embodiment, at least one second object matching a first target object is determined from a plurality of second objects; the first target object is any one of the plurality of first objects; when the at least one second object includes the second target object, and the at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects; wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, and the resource to be allocated is a resource run by the physical node. Thus, when the physical node and the resource to be allocated are mutually matched, the resource to be allocated is allocated to the physical node. Compared to related technologies that only consider the resource requirements of the resource to be allocated, this embodiment uses a bidirectional matching method for resource allocation, fully considering the matching results of both the resource to be allocated and the physical node, thereby obtaining a more suitable resource allocation result and solving the problem of unsatisfactory resource allocation results in related technologies.

[0032] Please see Figure 4 , Figure 4 This is a flowchart of another resource allocation method provided in an embodiment of this application. For example... Figure 4 As shown, the method includes the following steps: Step 410: Determine the first matching degree between the first target object and each of the multiple second objects.

[0033] In this embodiment, for any one of the plurality of second objects, the first matching degree between the first target object and the second object is used to describe the degree of preference of the first target object for that second object. For example, if the first matching degree of the first target object for object A is higher than the first matching degree of the first target object for object B, then the first target object is more biased towards object A than object B. The first matching degree can be selected as an indicator describing the resource usage of a physical node, such as the CPU load of the physical node or the resource utilization rate of the physical node.

[0034] Step 420: Based on the first matching degree between the first target object and each of the plurality of second objects, determine at least one second object from the plurality of second objects that matches the first target object.

[0035] In this embodiment, at least one second object among the plurality of second objects whose first matching degree with the first target object is higher than a preset value can be determined as at least one second object matching the first target object. Alternatively, the number of matching objects for the first target object can be preset. For example, if the number of matching objects is 1, then the second object among the plurality of second objects with the highest first matching degree with the first target object can be determined as the second object matching the first target object. For example, if the number of matching objects is 2, then 2 second objects can be selected from the plurality of second objects as the second objects matching the first target object in descending order of first matching degree.

[0036] Step 430: If at least one second object includes a second target object, and at least one first object matching the second target object includes the first target object, the resources to be allocated are allocated to physical nodes.

[0037] In this embodiment of the application, the degree of matching between the first target object and each second object can be used to more objectively evaluate the degree of matching between the resource to be allocated and the physical node. The at least one second object that matches the first target object is determined in this way more accurately.

[0038] In one embodiment of this application, the plurality of second objects are a plurality of physical nodes, the first target object is a resource to be allocated, and the second target object is a physical node. Step 410, determining the first matching degree between the first target object and each of the plurality of second objects, includes: determining the target resource utilization rate of each of the plurality of physical nodes, the target resource utilization rate indicating the resource utilization rate of the physical node when the resource to be allocated is allocated to the physical node; and determining the first matching degree between the resource to be allocated and each of the plurality of physical nodes based on the target resource utilization rate of each of the plurality of physical nodes.

[0039] In this embodiment, the target resource utilization rate indicates the predicted resource utilization rate of the physical node when the resource to be allocated is deployed to the physical node (in reality, the resource to be allocated is not deployed to the physical node). The target resource utilization rate is the utilization rate of one resource of the physical node, or multiple utilization rates of multiple resources. For example, the target resource utilization rate is the memory utilization rate of the physical node. For each of the plurality of physical nodes, the memory utilization rate of the physical node when the resource to be allocated is allocated to the physical node can be determined as a first matching degree between the resource to be allocated and the physical node.

[0040] In this embodiment, for any one of the plurality of physical nodes, the first matching degree between the resource to be allocated and the physical node is positively correlated with the target resource utilization rate of the physical node. That is, when the resource to be allocated is deployed to the physical node, the higher the target resource utilization rate of the physical node, the higher the first matching degree between the resource to be allocated and the physical node, and the more likely the resource to be allocated to that physical node. This ensures that the final resource allocation scheme allows the resource to be allocated to centrally consume resources on one or more physical nodes, while other idle physical nodes can be reserved for subsequent virtual machines to be deployed, allowing for a more compact allocation of resources across physical nodes.

[0041] It should be noted that the method for determining the first matching degree is not limited to the scenario where the first object is a resource to be allocated and the second object is a physical node; it also applies to scenarios where the first object is a physical node and the second object is a resource to be allocated. For example, the first target object is a physical node, and the plurality of second objects are plurality of resources to be allocated. Determining the first matching degree between the first target object and each of the plurality of second objects includes: for any one of the plurality of resources to be allocated, determining the target resource utilization rate of the physical node (the first target object), where the target resource utilization rate indicates the resource utilization rate of the physical node when the resource to be allocated is allocated to the physical node; obtaining a plurality of target resource utilization rates based on the plurality of resources to be allocated; and determining the first matching degree between the physical node and each of the plurality of resources to be allocated based on the plurality of target resource utilization rates. For ease of description, the following description uses the scenario where the first object is a resource to be allocated and the second object is a physical node as an example.

[0042] In one embodiment of this application, the target resource utilization rate includes N resource utilization rates for each of the plurality of physical nodes, where N is an integer greater than 1. Determining the first matching degree between the resource to be allocated and each of the plurality of physical nodes based on the target resource utilization rate of each of the plurality of physical nodes includes: determining the average resource utilization rate of the physical node based on the N resource utilization rates of each of the plurality of physical nodes; determining a balance index for the physical node based on the N resource utilization rates and the average resource utilization rate, the balance index indicating the degree of balance of various resources on the physical node when the resource to be allocated is assigned to the physical node; and determining the first matching degree between the resource to be allocated and the physical node based on the average resource utilization rate and the balance index.

[0043] In this embodiment, the determination of the first matching degree of different physical nodes among the plurality of physical nodes is carried out in the same way. The following examples illustrate the determination of the first matching degree between the resource to be allocated and any physical node. For any physical node among the plurality of physical nodes, the N resource utilization rates of the physical node may include the N resource utilization rates of the N types of resources provided by the physical node. These N resource utilization rates include the resource utilization rate of each of the N types of resources provided by the physical node. The N types of resources include, for example, at least two of CPU cores, memory, and hard disks. However, it should be noted that they are not limited to the CPU cores, memory, and hard disks listed here; it is only necessary to ensure that they are resources that the physical node can provide. For the i-th type of resource among the N types of resources, the resource utilization rate of the physical node providing the i-th type of resource can be obtained by the following formula: ; Where v represents the resource to be allocated, and h represents the physical node. This is used to represent the resource utilization rate of the i-th type of resource of the physical node when the resource to be allocated is assigned to the physical node. This is used to represent the usage of the i-th type of resource of the physical node before the resource to be allocated is assigned to the physical node. This is used to represent the usage of the resource to be allocated for the i-th type of resource. This is used to represent the total amount of the i-th type of resource provided by the physical node.

[0044] The average resource utilization rate of the physical node is the average of the N resource utilization rates of the physical node, which can be referred to in the following formula: ;in, Used to represent the average resource utilization rate of the physical node. This is used to represent the resource utilization rate of the i-th type of resource of the physical node when the resource to be allocated is assigned to the physical node.

[0045] For example, the equilibrium index can be the variance of the N resource utilization rates of the physical node. Determining the equilibrium index of the physical node based on the N resource utilization rates and the average resource utilization rate includes: determining the equilibrium index of the physical node using the following formula based on the N resource utilization rates and the average resource utilization rate: ;in, The equilibrium index used to represent the physical nodes. This is used to represent the resource utilization rate of the i-th type of resource of the physical node when the resource to be allocated is assigned to the physical node. This is used to represent the average resource utilization rate of the physical nodes. However, it should be noted that the equilibrium index is not limited to the variance listed here, but can also be the standard deviation of the N resource utilization rates.

[0046] In this embodiment, for any one of the plurality of physical nodes, the first matching degree between the resource to be allocated and the physical node is negatively correlated with the balance index of the physical node. That is, when the resource to be allocated is deployed to the physical node, the smaller the balance index of the physical node, the higher the first matching degree between the resource to be allocated and the physical node, and the more likely the resource to be allocated to the physical node. This ensures that after the resource to be allocated is deployed to the physical node, the remaining resources of the physical node remain balanced, avoiding a situation where some resources of the physical node are exhausted while others are wasted.

[0047] In determining the first matching degree between the resource to be allocated and the physical node based on the average resource utilization rate and the equilibrium index, the difference between the average resource utilization rate and the equilibrium index can be determined as the first matching degree between the resource to be allocated and the physical node. Specifically, the following formula can be used as a reference: ;in, Used to represent the first matching degree Used to represent the average resource utilization rate of the physical node. The equilibrium index used to represent the physical node.

[0048] Furthermore, in determining the first matching degree between the resource to be allocated and the physical node, the first weight of the average resource utilization rate and the second weight of the equilibrium index can be combined to adjust the proportion of the average resource utilization rate and the equilibrium index in the first matching degree. Specifically, a first value is determined by combining the average resource utilization rate with its first weight; a second value is determined based on the equilibrium index and its second weight; and the first matching degree between the resource to be allocated and the physical node is determined based on the first value and the second value. For example, the first matching degree between the resource to be allocated and the physical node can be determined by referring to the following formula: ; in, Used to represent the first matching degree Used to represent the average resource utilization rate of the physical node. The equilibrium index used to represent the physical nodes. Used to represent the first weight, This is used to represent the second weight. Both the first weight and the second weight are positive numbers less than 1, and can be adjusted and set according to the actual situation. For example, if the average resource utilization rate of physical nodes is valued more than the resource balance of physical nodes during resource allocation, then the first weight can be set to be greater than the second weight; if the resource balance of physical nodes is valued more than the average resource utilization rate of physical nodes during resource allocation, then the first weight can be set to be less than the second weight.

[0049] Considering that during resource allocation, most physical nodes may be in an idle state, such as when allocating resources to a newly created resource pool, the first matching degree of a virtual machine calculated using the above method may be the same for most physical nodes. This situation is not conducive to selecting physical nodes. To solve this problem, a very small random number can be introduced in the process of determining the first matching degree between the resource to be allocated and the physical node to avoid a large number of identical values. Moreover, since the value of this random number is very small, it has almost no impact on the matching degrees of resources that are not originally the same. Specifically, in one embodiment of this application, determining the first matching degree between the resource to be allocated and the physical node based on the average resource utilization rate and the balance index includes: determining a matching score based on the average resource utilization rate and the balance index; and determining the first matching degree between the resource to be allocated and the physical node based on the matching score and the random number.

[0050] In this embodiment, the difference between the average resource utilization rate and the equilibrium index can be determined as the matching score, and the sum of the matching score and the random number can be determined as the first matching degree between the resource to be allocated and the physical node. Specifically, the following formula can be referred to: ; in, Used to represent the first matching degree Used to represent the average resource utilization rate of the physical node. The equilibrium index used to represent the physical nodes. This is used to represent the random number. The random number can be understood as a random perturbation value, and the value range of the random number can be [-10]. -6 10 -6 It should be noted that the range of values ​​listed here is only an example. It is only necessary to ensure that the random number is a very small random number, and other smaller ranges of random numbers can also be used.

[0051] Furthermore, the first weight and the second weight can also be introduced in the process of determining the matching score. Specifically, in one embodiment of this application, determining the matching score based on the average resource utilization rate and the equilibrium index includes: determining a first score based on the average resource utilization rate and a first weight of the average resource utilization rate; determining a second score based on the equilibrium index and a second weight of the equilibrium index; and determining the matching score based on the first score and the second score. For example, the product of the average resource utilization rate and the first weight can be determined as the first score; the product of the equilibrium index and the second weight can be determined as the second score; and the sum of the first score and the second score can be determined as the matching score. Specifically, the process of determining the first matching degree can refer to the following formula: ; in, Used to represent the first matching degree Used to represent the average resource utilization rate of the physical node. The equilibrium index used to represent the physical nodes. Used to represent the first weight, Used to represent the second weight, Used to represent the random number.

[0052] In this way, in the process of determining the first matching degree, not only are random numbers introduced to avoid a large number of identical values, but the influence of average resource utilization and balance index on the calculation of the first matching degree is also taken into account, and the influence of the two can be dynamically adjusted, which can better screen physical nodes.

[0053] In this embodiment, a resource matching degree (first matching degree) is used to measure whether it is appropriate to place a resource to be allocated (e.g., a virtual machine) on a physical node (e.g., a physical host or a NUMA node on a host). A higher resource matching degree indicates greater suitability. Taking a virtual machine as the resource to be allocated and a physical host as the physical node as an example, if after a virtual machine i consumes the resources of a host j, the remaining resources of host j are relatively balanced and the resource utilization rate is high, then it means that the matching between virtual machine i and host j is relatively suitable.

[0054] Please see Figure 5 , Figure 5 This is a flowchart of another resource allocation method provided in an embodiment of this application. For example... Figure 5 As shown, the method includes the following steps: Step 510: Obtain the resource dependency of each virtual machine among multiple virtual machines; the resource dependency is used to indicate the degree of dependence of the virtual machine on the resources provided by the physical node.

[0055] In this embodiment, for any one of multiple virtual machines, the resource dependency of that virtual machine can be determined based on its resource requirements. Furthermore, the resource dependency of a virtual machine is positively correlated with its resource requirements; that is, the higher the resource requirements, the higher the resource dependency. The resource dependency of each virtual machine can be determined in the same way, directly defining its resource requirements for a specific resource as its resource dependency. For example, the resource requirements of the virtual machine's CPU cores can be determined as its resource dependency.

[0056] Step 520: Determine multiple virtual machines to be allocated from the multiple virtual machines in descending order of resource dependency.

[0057] Taking Q virtual machines and M virtual machines to be allocated as an example, the virtual machines can be sorted into a queue according to their resource dependencies from high to low: The M virtual machines at the front of the sorting queue can be identified as the M virtual machines to be allocated, i.e. The M virtual machines to be allocated are selected as the priority virtual machines for resource allocation. Here, Q and M are both integers greater than 1, with Q being greater than M.

[0058] Step 530: Determine at least one physical node from a plurality of physical nodes that matches the first target object, wherein the first target object is one of the plurality of virtual machines to be assigned.

[0059] In this embodiment of the application, during resource allocation, each virtual machine among the plurality of virtual machines to be allocated can be concurrently scheduled; that is, at least one physical node matching each of the plurality of virtual machines to be allocated is determined through concurrent scheduling. (See also...) Figure 6 , Figure 6 This is a schematic diagram of concurrent scheduling provided in an embodiment of this application. The multiple virtual machines to be allocated can form an allocation queue, such as... Figure 6 As shown, the task dispatcher is used to schedule virtual machines within the queue to be assigned. Multiple scheduler instances enable concurrent scheduling of multiple virtual machines to be assigned, thereby improving the efficiency of resource allocation. Furthermore, at least one physical node matching each virtual machine can be determined in the same way. The following examples illustrate the process of determining at least one physical node matching the first target object from multiple physical nodes. However, it should be noted that concurrent scheduling here is only an example and is not limited to using concurrent scheduling.

[0060] Step 540: If at least one physical node includes a second target object, and at least one virtual machine matched by the second target object includes the first target object, the first target object is assigned to the second target object, wherein the second target object is one of the multiple physical nodes.

[0061] In this embodiment, during resource allocation, virtual machines with higher resource dependencies have higher requirements for physical nodes, typically requiring physical nodes to provide more or scarcer resources. Therefore, virtual machines with higher resource dependencies can be prioritized for resource allocation, allowing them to consume resources provided by physical nodes first. This avoids the need to activate new physical nodes for these virtual machines later, thus preventing resource waste.

[0062] In one embodiment of this application, step 510, obtaining the resource dependency of each virtual machine among a plurality of virtual machines, includes: obtaining the resource requirement of each virtual machine among the plurality of virtual machines; determining the total resource requirement of the plurality of virtual machines based on the resource requirement of each virtual machine among the plurality of virtual machines; and determining the resource dependency of each virtual machine among the plurality of virtual machines based on the resource requirement of each virtual machine among the plurality of virtual machines and the total resource requirement.

[0063] In this embodiment, the total resource requirement of each of the plurality of virtual machines can be determined as the total resource requirement of the plurality of virtual machines. For any one of the plurality of virtual machines, the resource dependency of that virtual machine can be the quotient of its resource requirement and the total resource requirement. However, it should be noted that this is only one way to determine the resource dependency; other parameters, such as weights, can also be introduced in the process of determining the resource dependency.

[0064] Since the resource dependency of each virtual machine in multiple virtual machines can be determined in the same way, the following example illustrates the process of determining the resource dependency of any one of the multiple virtual machines. The resource requirement of a virtual machine can be the requirement of the virtual machine for a specific resource or multiple requirements for various resources. Taking the resource requirement as a single requirement for a single resource, such as the CPU core requirement, as an example, if the multiple virtual machines are virtual machine 1 (vm1), virtual machine 2 (vm2), and virtual machine 3 (vm3), and virtual machine 1 requires 4 CPU cores, virtual machine 2 requires 6 CPU cores, and virtual machine 3 requires 4 CPU cores, then the resource requirement of virtual machine 1 is 4, the resource requirement of virtual machine 2 is 6, and the resource requirement of virtual machine 3 is 4, for a total resource requirement of 14. Based on this, the resource dependency of virtual machine 1 can be determined to be 2 / 7, the resource dependency of virtual machine 2 is 3 / 7, and the resource dependency of virtual machine 3 is 2 / 7.

[0065] In this way, the total resource demand is also taken into account when determining the resource dependency of each virtual machine, which can better assess the overall dependency of each virtual machine on the resources provided by the physical node, and the resulting resource dependency is more robust.

[0066] In one embodiment of this application, the resource demand includes N demand quantities for N types of resources, each of the N demand quantities representing the demand for one type of resource among the N types of resources. The total resource demand includes N total demand quantities for the N types of resources, each of the N total demand quantities representing the total demand of the plurality of virtual machines for one type of resource among the N types of resources, where N is an integer greater than 1. Determining the resource dependency of each of the plurality of virtual machines based on the resource demand quantity of each of the plurality of virtual machines and the total resource demand includes: for the i-th type of resource among the N types of resources, determining the resource demand rate of each of the plurality of virtual machines for the i-th type of resource based on the demand quantity of each of the plurality of virtual machines for the i-th type of resource and the total demand of the plurality of virtual machines for the i-th type of resource; determining N resource demand rates of each of the plurality of virtual machines based on the N types of resources; and determining the resource dependency of each of the plurality of virtual machines based on the N resource demand rates.

[0067] Specifically, for the i-th resource among the N types of resources, the total demand for the i-th resource by the multiple virtual machines can be determined by referring to the following formula: ;in, Q represents the total demand of the i-th type of resource by the plurality of virtual machines, and Q represents the number of the plurality of virtual machines. This is used to represent the demand of the j-th virtual machine among the plurality of virtual machines for the i-th type of resource.

[0068] In this embodiment, for the j-th virtual machine among the plurality of virtual machines, the quotient of the j-th virtual machine's demand for the i-th resource and the total resource demand for the i-th resource can be determined as the resource demand rate of the j-th virtual machine for the i-th resource. Similarly, based on the N types of resources, the N resource demand rates of the j-th virtual machine for the N types of resources are determined, and the sum of the N resource demand rates can be determined as the resource dependency of the j-th virtual machine. Specifically, the following formula can be referred to: ; in, Used to represent the resource dependency of the j-th virtual machine, Used to represent the total resource demand for the i-th type of resource. This is used to represent the demand of the j-th virtual machine for the i-th type of resource.

[0069] In one embodiment of this application, determining the resource dependency of each virtual machine among the plurality of virtual machines based on the N resource demand rates includes: obtaining the weight of each of the N types of resources; and determining the resource dependency of each virtual machine among the plurality of virtual machines based on the weight of each of the N types of resources and the N resource demand rates.

[0070] In this embodiment, different resources have different weights. A higher weight for a resource means that it should be given priority in determining resource dependency. The weight of each of the N resources can be a preset weight, which can be adjusted and set according to the actual situation. For the j-th virtual machine among the plurality of virtual machines, the product of the resource demand rate of the j-th virtual machine for the i-th resource and the weight of the i-th resource can be determined as the dependency value of the j-th virtual machine for the i-th resource. Similarly, based on the N resources, N dependency values ​​of the j-th virtual machine for the N resources can be determined, and the N dependency values ​​include the dependency value of the j-th virtual machine for each of the N resources. The sum of the N dependency values ​​is determined as the resource dependency of the j-th virtual machine. For example, the following formula can be used: ; in, Used to represent the resource dependency of the j-th virtual machine, Used to represent the total resource demand for the i-th type of resource. This is used to represent the demand of the j-th virtual machine for the i-th type of resource. Used to represent the weight of the i-th type of resource.

[0071] It should be noted that the formula here has been normalized for various resources. However, in determining resource dependencies, resource normalization is not limited to the method shown in the formula. For example, normalization can also be performed in the following way: for any resource, the difference between the maximum and minimum resource requirements can be used as the denominator, and the difference between the virtual machine's resource requirements and the minimum resource requirements can be used as the numerator. The specific method depends on the scale, and the normalization result should be avoided as much as possible (close to 0) or as much as possible (close to 1). The specific normalization algorithm can be flexibly selected according to the actual situation.

[0072] In one embodiment of this application, the weight of each of the N resources is obtained based on the resource scarcity of each of the N resources, and the weight of each of the N resources is positively correlated with the resource scarcity of each of the N resources. In this way, the resource scarcity of each resource is fully considered in the process of determining the weight of each resource, and the weight obtained in this way matches the actual resource supply situation.

[0073] In this embodiment, the resource scarcity is used to represent the degree of scarcity among the N types of resources provided by the physical nodes. For the i-th resource among the N types of resources, a higher resource scarcity indicates that the i-th resource is more scarce among the various resources provided by the multiple physical nodes. The resource scarcity of the i-th resource can be a preset scarcity level. In the process of obtaining the weight of each of the N types of resources based on their resource scarcity, the N types of resources can be sorted from high to low according to their resource scarcity, and the weight of each of the N types of resources can be determined using an arithmetic sequence. For example, the resource with the highest resource scarcity has a weight of 100, and the resource with the lowest resource scarcity has a weight of 10. If the N types of resources are, for example, CPU cores, memory, and hard disks, and are sorted according to resource scarcity: hard disk > memory > CPU cores, then the weight of the hard disk can be 100, the weight of the memory can be 55, and the weight of the CPU cores can be 10.

[0074] It should be noted that the weight of a resource is not necessarily within the range of [10, 100], and other ranges can be set. The embodiments of this application do not necessarily use an arithmetic sequence to determine the weight of each resource; a geometric sequence or other methods can also be used, as long as it reflects that resources with higher scarcity have higher weights.

[0075] In one embodiment of this application, the method for obtaining the resource scarcity includes: obtaining the total resource amount of each of the N types of resources; and determining the resource scarcity of each of the N types of resources based on the total resource amount of each of the N types of resources and the total demand of each of the N types of resources.

[0076] In this embodiment, the total resource amount can be the total resource amount for each type of resource provided to multiple nodes. These multiple nodes are nodes capable of hosting virtual machines, and the multiple physical nodes can be at least a subset of these nodes. For the i-th type of resource among the N types of resources, the resource scarcity of the i-th resource can be determined by the quotient of the total demand for the i-th resource and the total resource amount of the i-th resource. Specifically, the following formula can be used: ; in, Used to represent the resource scarcity of the i-th resource. Used to represent the total demand for the i-th type of resource. Used to represent the total amount of the i-th type of resource.

[0077] In this example, there are three virtual machines: VM1, VM2, and VM3, and two nodes: host1 (h1) and host2 (h2). The resource requirements of the three virtual machines and the resource availability of the two nodes are as follows: vm1 (cpu: 4, mem: 40, disk: 200); vm2 (cpu: 6, mem: 60, disk: 400); vm3 (cpu: 4, mem: 60, disk: 300); h1 (cpu: 64, mem: 200, disk: 1000); h2 (cpu: 64, mem: 256, disk: 1000); In other words, VM1 requires 4 CPU cores, 40GB of RAM, and 200GB of storage; VM2 requires 6 CPU cores, 60GB of RAM, and 400GB of storage; and VM3 requires 4 CPU cores, 60GB of RAM, and 300GB of storage. H1 provides a 64-core CPU, 200GB of RAM, and 1000GB of storage; while H2 provides a 64-core CPU, 256GB of RAM, and 1000GB of storage.

[0078] Based on the above data, the total demand for each resource can be calculated as follows: CPU core demand vResource(cpu) = 4 + 6 + 4 = 14; memory demand vResource(mem) = 40 + 60 + 60 = 160; hard disk demand vResource(disk) = 200 + 400 + 300 = 900. The total resource quantity for each resource is also calculated as follows: CPU core demand hResource(cpu) = 64 + 64 = 128; memory demand hResource(mem) = 200 + 256 = 456; hard disk demand hResource(disk) = 1000 + 1000 = 2000.

[0079] Based on the total demand and total resources for each resource, the resource scarcity of each resource can be obtained: resource scarcity of CPU cores (cpu) = 14 / 128 ≈ 0.1094; resource scarcity of memory (mem) = 160 / 456 ≈ 0.3509; resource scarcity of hard disk (disk) = 900 / 2000 = 0.45. Therefore, the result of sorting the three resources from highest to lowest resource scarcity is: hard disk (disk) > memory (mem) > CPU cores (cpu). Using an arithmetic sequence, the weights of the three resources can be obtained as: hard disk (100) > memory (55) > CPU cores (10).

[0080] Based on the above data, the resource dependency of each of the three virtual machines can be obtained: the resource dependency of vm1 is vResourceWeight1 = (4 / 14). 10+ (40 / 160) 55+(200 / 900) 100≈38.83; vResourceWeight2 = (6 / 14) is the resource dependency of vm2. 10+(60 / 160) 55+(400 / 900) 100≈69.36; vResourceWeight3 = (4 / 14) is the resource dependency of vm3. 10+(60 / 160) 55+(300 / 900) 100≈56.82.

[0081] In this embodiment of the application, a virtual machine scheduling sequence (consisting of multiple virtual machines to be assigned) can be obtained through the above process. Please refer to [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic diagram illustrating the logic for generating a queue to be allocated, as provided in an embodiment of this application. For example... Figure 7 As shown, the scarcity of resources required by virtual machines in the resource pool can be calculated. The weights of various resources are defined according to their scarcity. The resource dependencies of each virtual machine are calculated by weighting the resource weights and the virtual machine's demand for each resource. The virtual machines are sorted in descending order of resource dependency and selected from the beginning to form a queue to be allocated.

[0082] Please see Figure 8 , Figure 8 This is a flowchart of another resource allocation method provided in an embodiment of this application. For example... Figure 8 As shown, the method includes the following steps: Step 810: Determine at least one second object from a plurality of second objects that matches the first target object; the first target object is any one of the plurality of first objects.

[0083] Step 820: Determine at least one first object from a plurality of first objects that matches the second target object; the second target object is any one of the plurality of second objects.

[0084] In this embodiment of the application, for any one of the plurality of first objects, at least one second object matching the first object can be determined from the plurality of second objects. Correspondingly, for any one of the plurality of second objects, at least one first object matching the second object can be determined. It is understood that at least one second object matching the first target object includes the second target object, but this does not mean that at least one first object matching the second target object includes the first target object. That is, at least one first object matching the second target object may still not include the first target object.

[0085] Step 830: If at least one second object includes a second target object and at least one first object includes the first target object, allocate the resources to be allocated to the physical nodes.

[0086] In this embodiment, the matching status of each party (resource to be allocated or physical node) with the other can be determined, providing data support for subsequent bidirectional matching. For example, multiple first objects are object 1, object 2, and object 3, and multiple second objects are object A and object B. If object 1 matches object A, object 2 matches object A, object 3 matches object B, object A matches object 2, and object B matches object 3, then object 2 and object A are mutually matched, and object 3 and object B are mutually matched. If the first object is a resource to be allocated and the second object is a physical node, object 2 can be allocated to object A, and object 3 can be allocated to object B.

[0087] In one embodiment of this application, step 820, which determines at least one first object from a plurality of first objects that matches the second target object, includes: determining a second matching degree between the second target object and each of the plurality of first objects; and determining at least one first object from the plurality of first objects that matches the second target object based on the second matching degree between the second target object and each of the plurality of first objects.

[0088] In this embodiment, for any one of a plurality of first objects and any one of a plurality of second objects, the first matching degree between the first object and the second object may be different from or the same as the second matching degree between the first object and the second object. For example, if the first matching degree and the second matching degree are determined using different methods, the first matching degree may be determined based on the resource utilization rate of a certain resource of a physical node, and the second matching degree may be determined based on the average resource utilization rate and a balance index. Alternatively, the first matching degree and the second matching degree may be determined in the same way. In this case, both the first matching degree and the second matching degree can be understood as the resource matching degree between the resource to be allocated and the physical node. The process for determining the second matching degree can refer to the process for determining the first matching degree described above, and will not be repeated here.

[0089] In one embodiment of this application, the at least one second object is the second target object, and the plurality of first objects includes at least two first objects, each of the at least two first objects matching the second target object. Determining at least one first object matching the second target object from the plurality of first objects includes: determining the single first object with the highest second matching degree between it and the second target object from the at least two first objects.

[0090] In this embodiment, the idea of ​​a stable mating algorithm, where one party actively applies and the other party selects based on merit, can be adopted. For example, multiple first objects can be three virtual machines (represented as vm1, vm2, and vm3), and multiple second objects can be three physical nodes (represented as h1, h2, and h3). The first and second matching degrees are determined in the same way, and are described below using resource matching degrees. The resource matching degree between a virtual machine and a physical node can be used to measure whether placing the virtual machine on that physical node is appropriate; a higher resource matching degree indicates a more suitable match between the virtual machine and the physical node. If, after the virtual machine consumes the resources of the physical node, the remaining resources of the physical node are relatively balanced and the resource utilization is high, then the match between the virtual machine and the physical node is relatively appropriate. The resource matching degrees of the three virtual machines and the three physical nodes are as follows: vm1:h1,h2,h3(0.5,0.8,0.6); vm2:h1,h2,h3(0.7,0.6,0.4); vm3:h1,h2,h3(0.8,0.9,0.7); In this scenario, after one round of matching, virtual machine vm1 will select physical node h2, virtual machine vm2 will select physical node h1, and virtual machine vm3 will select physical node h2. In this case, physical node h2 is selected by two virtual machines (virtual machine vm1 and virtual machine vm3), where the aforementioned at least two first objects are, for example, virtual machine vm1 and virtual machine vm3 here. Physical node h2 can choose the more suitable virtual machine from virtual machine vm1 and virtual machine vm3, i.e., virtual machine vm3 with a higher resource matching degree. Physical node h2 rejects virtual machine vm1, and virtual machine vm1 waits for the next round of matching. Since physical node h1 was only selected by one virtual machine (virtual machine vm2) in this round, physical node h1 accepts the request from virtual machine vm2. Since physical node h3 was not selected by a virtual machine in this round of matching, no virtual machine will be allocated to physical node h3 in this round.

[0091] Please see Figure 9 , Figure 9 This is a flowchart of another resource allocation method provided in an embodiment of this application. For example... Figure 9 As shown, the method includes the following steps: Step 910: Obtain the resource dependency of each virtual machine among multiple virtual machines; the resource dependency is used to indicate the degree to which the virtual machine depends on the resources provided by the physical node.

[0092] Step 920: Determine M virtual machines to be allocated from the plurality of virtual machines in descending order of resource dependency, and form an allocation queue from the M virtual machines to be allocated.

[0093] Step 930: Determine at least one physical node from multiple physical nodes that matches the first target object, wherein the first target object is one of the M virtual machines to be allocated.

[0094] In this embodiment, the plurality of physical nodes can be at least a subset of physical nodes selected from a plurality of nodes that can meet the resource requirements of the plurality of virtual machines to be allocated. The plurality of physical nodes can be understood as currently active physical nodes, i.e., the physical nodes where virtual machines are currently placed. Nodes other than the plurality of physical nodes can be understood as inactive physical nodes, and virtual machines will not be placed on inactive physical nodes at this time. In this way, it is only necessary to determine the matching status of the virtual machine to be allocated with each of the plurality of physical nodes, rather than determining the matching status of the virtual machine to be allocated with each physical node in the plurality of nodes, thus reducing the computational load of the resource matching process.

[0095] Step 940: If at least one physical node includes a second target object, and at least one virtual machine matched by the second target object includes the first target object, the virtual machine to be assigned is assigned to the physical node, wherein the second target object is one of the multiple physical nodes.

[0096] Step 950: Remove the virtual machine to be allocated from the queue to be allocated.

[0097] In this embodiment, during a matching round, if any virtual machine in the allocation queue is assigned to the physical node, it can be removed from the allocation queue to prevent it from entering the next matching round. Furthermore, during a matching round, multiple virtual machines in the allocation queue are matched concurrently, and multiple of the M virtual machines in the allocation queue may be successfully matched. That is, after a matching round ends, multiple virtual machines may be removed from the allocation queue.

[0098] Step 960: If K virtual machines are removed from the queue to be allocated, select K virtual machines from the remaining virtual machines and add them to the queue to be allocated, so that the queue to be allocated still contains M virtual machines.

[0099] In this embodiment, the remaining virtual machines are those other than the M unallocated resources among the plurality of virtual machines, where M and K are both positive integers, and M is greater than K. The K unallocated virtual machines removed from the allocation queue are allocated using a concurrent scheduling method. The K virtual machines may include those removed during a single round of matching. For example, after a round of matching, if K unallocated virtual machines out of the M unallocated virtual machines are successfully matched, then these K unallocated virtual machines can be removed from the allocation queue, leaving MK unallocated virtual machines in the queue. To ensure the efficiency of concurrent scheduling in the allocation queue, K virtual machines can be added to the allocation queue to ensure that the queue still contains M unallocated virtual machines, which can then be matched in the next round. The K virtual machines can be at least one virtual machine selected from the remaining virtual machines according to their resource dependency from high to low.

[0100] In one embodiment of this application, the plurality of physical nodes form a node queue. The number of the plurality of physical nodes can be determined based on the total resource requirements of the M virtual machines to be allocated, that is, the plurality of physical nodes can meet the resource requirements of the M virtual machines to be allocated. In addition to steps 710-760 described above, the resource allocation method further includes: removing a first specific physical node from the node queue, wherein the first specific physical node is a physical node that cannot meet the resource requirements of any virtual machine in the queue to be allocated; and adding a second specific physical node to the node queue, wherein the second specific physical node is a physical node that can meet the resource requirements of any virtual machine in the queue to be allocated.

[0101] In this embodiment of the application, the second specific physical node may be at least one node selected from the remaining nodes, wherein the remaining nodes are nodes other than the plurality of physical nodes among the plurality of nodes. The following describes the process of stable matching between the queue to be allocated and the node queue, which can be referred to... Figure 10 and Figure 11 , Figure 10 This is a schematic diagram of a stable matching process provided in an embodiment of this application. Figure 11 This is a flowchart illustrating a stable matching process provided in an embodiment of this application. Figure 10 As shown, there are Q virtual machines and multiple nodes, including multiple activated physical nodes and physical nodes waiting to be activated.

[0102] Based on the resource dependency of each of the Q virtual machines, M virtual machines are selected from the Q virtual machines in descending order of resource dependency to form a queue for allocation, such as... Figure 10 As shown in the middle number ①, that is Figure 10There are M unscheduled virtual machines. The purpose of sorting is to prioritize virtual machines with high resource dependencies, placing them at the front of the queue to consume scarcer resources. In subsequent matching batches, the number of unmatched virtual machines may be less than m, at which point the number of virtual machines in the queue is no longer M. Simultaneously, multiple physical nodes are selected from multiple nodes to form a node queue, i.e. Figure 10 The diagram shows multiple activated physical nodes. The length of the node queue can be determined based on the total resource requirements of the M virtual machines. In other words, it is only necessary to ensure that the selected physical nodes can meet the resource requirements of the M virtual machines, without selecting too many physical nodes, thus avoiding excessive workload in the resource matching process.

[0103] Then, a stable matching process is performed between the M virtual machines to be allocated in the allocation queue and the multiple physical nodes in the node queue, i.e. Figure 10 As shown in number ③. The idea behind the stable matching algorithm is as follows: a virtual machine finds a host with the highest resource matching degree after its placement and initiates a matching request to that host. During a single matching round, multiple virtual machines may initiate matching requests to the same host. The host will respond to the virtual machine with the highest resource matching degree among those requesting matching in that round, rejecting the others. If only one virtual machine requests matching in that round, the host will directly respond to that virtual machine's request.

[0104] After one round of matching, if K out of the M virtual machines to be allocated have been successfully matched, these K virtual machines can be removed from the allocation queue. Then, K virtual machines are selected from the remaining virtual machines in descending order of resource dependency and added to the allocation queue. Furthermore, if there is an active physical node in the node queue, and the remaining resources of this physical node are insufficient to accommodate any virtual machine in the allocation queue, this active physical node is the first specific physical node. In this case, the active physical node has very few idle resources, and it is removed from the node queue.

[0105] like Figure 11As shown, the overall matching process is as follows: M unscheduled virtual machines are selected from multiple virtual machines, and a preference queue for each virtual machine is generated based on its resource matching degree, indicating its potential physical node. Stable matching is performed between the M virtual machines and the potential physical nodes, with each virtual machine searching for its most suitable physical node according to its preference queue. For each potential physical node, if only one virtual machine requests a match, its request is accepted directly; otherwise, the request from the virtual machine with the highest resource matching degree is accepted, and requests from other virtual machines are rejected. After one round of matching, the matching mapping table between physical nodes and virtual machines is updated, and matched virtual machines (i.e., successfully matched virtual machines) are removed from the allocation queue.

[0106] Furthermore, for any virtual machine to be allocated in the allocation queue, if all activated physical nodes in the node queue cannot meet the resource requirements of the virtual machine to be allocated, then a physical node can be activated from the remaining nodes (multiple physical nodes can be activated simultaneously in large-scale scenarios). This physical node must meet the resource requirements of at least one virtual machine to be allocated in the allocation queue, and then the physical node is added to the node queue. This process is called... Figure 10 As shown in number ②.

[0107] However, it's important to note that the queue for allocation and the node queue in the above example are not mandatory. All virtual machines that have not yet been deployed are matched; there is no need to select a subset of virtual machines to form the queue for allocation. Similarly, virtual machines to be allocated can be directly matched with multiple nodes without needing to select a subset of nodes for activation.

[0108] Furthermore, for ease of description, the above-described stable matching algorithm is quite close to the original idea of ​​the stable mating algorithm. In practice, many modifications can be made to this algorithm when using stable mating for resource matching. For example, when a physical node receives multiple virtual machines (VMs) initiating matching requests during a round of matching, it can accept all requests from VMs, provided the physical node can accommodate them. Next, if the physical node receives another matching request from a VM and finds that its remaining resources are insufficient to satisfy this newly requesting VM, it can check if any of the previously matched VMs have a lower resource compatibility with the physical node than the current VM. If so, it can replace the VM. In other words, resource compatibility is used to decide which VMs to retain and which to reject, rather than relying solely on a first-come, first-served strategy.

[0109] It should be noted that in this embodiment, when determining the matching preference queue between virtual machines and hosts, resource matching degree may not be used. Instead, other metrics can be used. In scenarios where resource utilization is prioritized, a metric similar to resource matching degree can be used. In scenarios where performance is prioritized, other metrics, such as CPU load, can be used to define the preference queue. Furthermore, the resource matching method provided in this embodiment is not only applicable to the placement of batches of virtual machines but can also be applied to the placement of a single virtual machine. It can find the most suitable physical node for the virtual machine based on the resource matching degree.

[0110] For reference Figure 12 , Figure 12 This is a flowchart illustrating a resource allocation method provided in an embodiment of this application. Figure 12 As shown, the method includes the following steps: Step 1210: Obtain the resource requirement of each virtual machine among the plurality of virtual machines, and determine the total resource requirement of the plurality of virtual machines based on the resource requirement of each virtual machine among the plurality of virtual machines.

[0111] Step 1215: For the i-th resource among the N types of resources, based on the demand of each virtual machine for the i-th resource and the total demand of the multiple virtual machines for the i-th resource, determine the resource demand rate of each virtual machine for the i-th resource.

[0112] Step 1220: Based on the N types of resources, determine the N resource demand rates for each of the plurality of virtual machines.

[0113] Step 1225: Obtain the weight of each of the N types of resources, and based on the weight of each of the N types of resources and the demand rate of the N resources, determine the resource dependency of each virtual machine among the multiple virtual machines.

[0114] Step 1230: Determine multiple virtual machines to be allocated from the multiple virtual machines in descending order of resource dependency.

[0115] Step 1235: For any one of the plurality of virtual machines to be allocated, determine the target resource utilization rate of each of the plurality of physical nodes, wherein the target resource utilization rate indicates the resource utilization rate of the physical node when the virtual machine to be allocated is allocated to the physical node.

[0116] Step 1240: Determine the average resource utilization rate of the physical nodes based on the N resource utilization rates of each of the plurality of physical nodes.

[0117] Step 1245: Based on the N resource utilization rates and the average resource utilization rate, determine the balance index of the physical node. The balance index indicates the degree of balance of various resources on the physical node when the virtual machines to be allocated are assigned to the physical node.

[0118] Step 1250: Based on the average resource utilization rate and the equilibrium index, determine the first matching degree between the virtual machine to be allocated and the physical node.

[0119] Step 1255: Based on the first matching degree between the virtual machine to be assigned and each of the plurality of physical nodes, determine at least one physical node from the plurality of physical nodes that matches the virtual machine to be assigned.

[0120] Step 1260: If at least one physical node includes the second target object, and at least one virtual machine matching the second target object includes the virtual machine to be assigned, the virtual machine to be assigned is assigned to the physical node.

[0121] The explanation and determination process of each indicator (such as the first matching degree, average resource utilization rate, equilibrium indicator, etc.) in the embodiments of this application can be referred to the previous text, and will not be repeated here.

[0122] In this embodiment, at least one second object matching a first target object is determined from a plurality of second objects; the first target object is any one of the plurality of first objects; when the at least one second object includes the second target object, and the at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects; wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, and the resource to be allocated is a resource run by the physical node. Thus, when the physical node and the resource to be allocated are mutually matched, the resource to be allocated is allocated to the physical node. Compared to related technologies that only consider the resource requirements of the resource to be allocated, this embodiment uses a bidirectional matching method for resource allocation, fully considering the matching results of both the resource to be allocated and the physical node, thereby obtaining a more suitable resource allocation result and solving the problem of unsatisfactory resource allocation results in related technologies.

[0123] The resource allocation method provided in this application can be applied to Virtual Machine Placement (VMP) technology. VMP is a core issue in resource scheduling in cloud computing and telecom cloud platforms, and its placement results directly determine the resource utilization, energy consumption level, and operating costs of data centers. How to compactly place business virtual machines on physical nodes to save more resources has always been a goal pursued by the industry. Especially in the construction of intelligent computing resource pools, a large number of heterogeneous acceleration resources are introduced, such as Graphics Processing Units (GPUs), smart network cards, and offloading cards. The diversity of resources makes resource scheduling and allocation very complex during virtual machine placement, and it is very easy for a large number of resource fragments to be scattered across computing nodes, mainly manifested as: Multiple virtual machines requiring fewer resources preemptively occupy those resources, leaving insufficient resources on each node to accommodate a virtual machine with slightly higher resource demands. Virtual machines that don't require scarce resources occupy nodes with scarce resources first, leaving virtual machines needing those resources without suitable hosts, thus wasting those resources. Furthermore, virtual machine placement doesn't consider all resource supply and demand factors, resulting in some resources being used up while others remain unused. The presence of numerous fragments not only reduces resource utilization and increases hardware costs but also increases energy consumption; therefore, energy conservation and energy saving are primary considerations in current resource pool construction.

[0124] In current mainstream methods, traditional heuristic strategies (such as the Best Fit algorithm) struggle to balance multi-dimensional resource coupling and fragmentation suppression. OpenStack, currently the most popular infrastructure cloud management platform in the industry, uses a Best Fit algorithm for resource scheduling. This algorithm focuses only on the resource requirements of the virtual machine to be placed, combining this with the remaining resources on the host machine to find the most suitable host for that virtual machine based on the availability of certain resources. While this algorithm is simple and direct, it has numerous drawbacks. Because it doesn't consider the resource requirements of subsequent virtual machines, it cannot comprehensively consider resource allocation, only achieving a relatively optimal allocation for the current virtual machine, not a globally optimal allocation. Furthermore, the algorithm cannot be parallelized; if multiple virtual machines enter the scheduling process simultaneously, it will lead to severe resource conflicts. The algorithm only focuses on the consumption of certain resources to decide the placement strategy for virtual machines, failing to address the problem of uneven resource consumption across different resource groups.

[0125] In addition, to improve overall performance, researchers have also considered introducing metaheuristic methods such as genetic algorithms (GA), particle swarm optimization (PSO), and ant colony optimization (ACO). Although these intelligent algorithms perform well in some metrics, they generally suffer from defects such as unstable convergence, uninterpretable decisions, and weak generalization ability, making it difficult to meet the stringent requirements of commercial systems for determinism, maintainability, and real-time response.

[0126] To address the aforementioned problems, this application provides a resource allocation method with the following key features: First, it proposes the concepts of resource matching degree and resource scarcity. The process of determining the resource matching degree considers both resource utilization and the complementarity of various resource uses during resource usage. For example, it allows virtual machines with high computing power and low memory requirements to be configured with virtual machines with high memory and low computing power requirements on the same host to fully leverage their complementary capabilities. In determining resource scarcity, the degree of scarcity of various resources is defined based on the supply and demand relationship. The resources required by the virtual machine description are the demand, and the resources that the physical host can provide are the supply. The scarcity of resources where demand is close to or greater than supply is greater, while the scarcity of resources where supply far exceeds demand is smaller.

[0127] Secondly, this application proposes the concept of resource dependency of virtual machines on resources provided by physical nodes, and introduces resource scarcity in the process of determining resource dependency. Resource scarcity allows for easy quantification of the degree of virtual machine dependency on resources. By defining the scarcity weights of various resources, the dependency degree of each virtual machine on host resources is calculated weighted according to the weights of various resources and the virtual machine's demand for each resource. Virtual machines with strong dependencies are placed first, so that scarce resources can be preferentially allocated to virtual machines with strong dependencies on these resources, which not only improves the placement success rate but also significantly reduces resource utilization.

[0128] Thirdly, this application provides a method for determining the preference list when a virtual machine selects a physical host and when a host selects a virtual machine. By using the concept of resource matching degree, a preference list is provided for both the virtual machine and the physical host when selecting each other. Furthermore, the preference value (resource matching degree) is consistent between the two parties; that is, the degree of preference of a virtual machine for a certain physical host can be the same as the degree of preference of that host for that virtual machine. Using the same value can reduce the computational load.

[0129] Fourth, the resource allocation method provided in this application is applicable to all scenarios where virtual machines need to be scheduled to physical hosts for placement, including scenarios such as creating new resource pools, expanding resource pools, and aggregating virtual machines in resource pools for energy saving and consumption reduction. The resource matching degree and resource scarcity provided in this application are calculated using the resources required by the virtual machine to be placed and the remaining available resources of the physical host as algorithm inputs, so it is not limited to the virtual machine placement operation when creating a new resource pool.

[0130] Fifth, the algorithm introduces a stable matching concept, allowing the host to perform a secondary screening of virtual machines, ensuring that those more suitable for the host are placed there, achieving a global optimization. This approach is unique among current algorithms and is particularly useful in concurrent scheduling, moving beyond a simple first-come, first-served basis. If a later-arriving virtual machine has a higher resource compatibility with the host, it can replace an earlier-arriving one.

[0131] Sixth, the stable matching algorithm is introduced to solve the problem of concurrent scheduling resource conflicts during resource scheduling. In traditional heuristic algorithms, multiple scheduling entities simultaneously perform placement operations on a large number of virtual machines. When selecting physical hosts, resource conflicts can easily occur on the physical hosts because the schedulers cannot see which host's resources the others are consuming. However, the resource allocation method provided in this application is a bidirectional selection method. There are no horizontal relationships between virtual machines or between hosts, and it provides excellent support for concurrency. Parallel resource scheduling is used when placing virtual machines, and the matching principle is the resource utilization rate and whether the use of various resources on the same host is balanced.

[0132] Seventh, resource scheduling fully considers all factors related to resource demand. For example, resource matching degree and resource dependence degree both take into account various resources in a unified manner. This effectively solves the problem of uneven resource consumption caused by traditional heuristic strategies that only consider a certain type of resource.

[0133] Furthermore, the embodiments of this application are applied to cloud computing virtual machine batch placement scenarios, enabling virtual machines to be matched with suitable physical hosts in parallel, while improving the utilization rate of various resources of the physical hosts and reducing resource fragmentation. The ideas of the embodiments of this application can also be applied to all resource allocation scenarios based on supply and demand. The algorithm output is interpretable, the algorithm time is predictable, and the process is also subject to human intervention. Specifically, the intelligent algorithms introduced by metaheuristic algorithms have poor interpretability, cannot be manually intervened, and the algorithm convergence speed is uncertain. These characteristics severely limit the engineering implementation in commercial scenarios. The solutions provided by this patent are all based on fixed mathematical model definitions, have very good interpretability and predictability, and can also be intervened in the execution process by manually adjusting each queue. Moreover, there is no uncertainty in algorithm convergence, and the resource utilization effect is good, making it very suitable for engineering implementation. It should be noted that the ideas involved in the patent can be applied to all resource consumption scheduling scenarios, not just virtual machine placement.

[0134] Please see Figure 13 , Figure 13 This is a schematic structural block diagram of a resource allocation device provided in an embodiment of this application. Figure 13 As shown, this application embodiment provides a resource allocation device 1300, which includes a determination module 1310 and an allocation module 1320.

[0135] The determining module 1310 is configured to determine at least one second object from a plurality of second objects that matches the first target object; the first target object is any one of the plurality of first objects; The allocation module 1320 is configured to allocate the resources to be allocated to a physical node when at least one second object includes a second target object and at least one first object matching the second target object includes the first target object; the second target object is any one of the plurality of second objects; Wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, wherein the resource to be allocated is a resource operated by the physical node.

[0136] In this embodiment, at least one second object matching a first target object is determined from a plurality of second objects; the first target object is any one of the plurality of first objects; when the at least one second object includes the second target object, and the at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects; wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, and the resource to be allocated is a resource run by the physical node. Thus, when the physical node and the resource to be allocated are mutually matched, the resource to be allocated is allocated to the physical node. Compared to related technologies that only consider the resource requirements of the resource to be allocated, this embodiment uses a bidirectional matching method for resource allocation, fully considering the matching results of both the resource to be allocated and the physical node, thereby obtaining a more suitable resource allocation result and solving the problem of unsatisfactory resource allocation results in related technologies.

[0137] The resource allocation device provided in this application embodiment can implement the various processes implemented in the above method embodiments, and will not be described again here to avoid repetition.

[0138] See also Figure 14 , Figure 14 This is a schematic structural block diagram of an electronic device provided in an embodiment of this application. Figure 14As shown in the illustration, this application also provides an electronic device 1400. The electronic device 1400 includes a processor 1410 and a memory 1420. The memory 1420 stores programs or instructions, which, when executed by the processor 1410, implement the steps of any of the methods described above. For example, when the program is executed by the processor 1410, it implements the following process: determining at least one second object from a plurality of second objects that matches a first target object; the first target object is any one of the plurality of first objects; in the case where the at least one second object includes the second target object, and the at least one first object matching the second target object includes the first target object, allocating resources to be allocated to physical nodes; the second target object is any one of the plurality of second objects; wherein the first target object is one of the resources to be allocated and the physical node, and the second target object is the other of the resources to be allocated and the physical node, and the resources to be allocated are resources operated by the physical node. Thus, when physical nodes and resources to be allocated are matched, the resources to be allocated are allocated to physical nodes. Compared with related technologies that only consider the resource requirements of the resources to be allocated, the embodiments of this application adopt a two-way matching method for resource allocation, which fully considers the matching results of both the resources to be allocated and physical nodes, thereby obtaining a more suitable resource allocation result and solving the problem of poor resource allocation results in related technologies.

[0139] This application also provides a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of various embodiments of the resource allocation method and achieve the same technical effect. To avoid repetition, these will not be described again here.

[0140] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0141] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0142] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here.

[0143] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0144] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0145] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A resource allocation method, characterized in that, include: Determine at least one second object from a plurality of second objects that matches the first target object; the first target object is any one of the plurality of first objects; If at least one second object includes a second target object, and at least one first object matching the second target object includes the first target object, the resource to be allocated is allocated to a physical node; the second target object is any one of the plurality of second objects. Wherein, the first target object is one of the resource to be allocated and the physical node, and the second target object is the other of the resource to be allocated and the physical node, wherein the resource to be allocated is a resource operated by the physical node.

2. The method according to claim 1, characterized in that, The step of determining at least one second object from a plurality of second objects that matches the first target object includes: Determine the first matching degree between the first target object and each of the multiple second objects; Based on a first matching degree between the first target object and each of the plurality of second objects, at least one second object that matches the first target object is determined from the plurality of second objects.

3. The method according to claim 2, characterized in that, The first target object is a resource to be allocated, and the plurality of second objects are multiple physical nodes; determining the first matching degree between the first target object and each of the plurality of second objects includes: Determine the target resource utilization rate for each of a plurality of physical nodes, wherein the target resource utilization rate indicates the resource utilization rate of the physical node when the resources to be allocated are allocated to the physical node; Based on the target resource utilization rate of each of the plurality of physical nodes, a first matching degree is determined between the resource to be allocated and each of the plurality of physical nodes.

4. The method according to claim 3, characterized in that, The target resource utilization rate includes N resource utilization rates for each of the plurality of physical nodes, where N is an integer greater than 1; determining the first matching degree between the resource to be allocated and each of the plurality of physical nodes based on the target resource utilization rate of each of the plurality of physical nodes includes: Based on the N resource utilization rates of each of the plurality of physical nodes, the average resource utilization rate of the physical nodes is determined; Based on the N resource utilization rates and the average resource utilization rate, a balance index for the physical node is determined. The balance index indicates the degree of balance of various resources on the physical node when the resources to be allocated are distributed to the physical node. Based on the average resource utilization rate and the equilibrium index, a first matching degree between the resource to be allocated and the physical node is determined.

5. The method according to claim 4, characterized in that, The step of determining the first matching degree between the resource to be allocated and the physical node based on the average resource utilization rate and the equilibrium index includes: Based on the average resource utilization rate and the equilibrium index, a matching score is determined; Based on the matching score and the random number, a first matching degree between the resource to be allocated and the physical node is determined.

6. The method according to claim 5, characterized in that, The process of determining the matching score based on the average resource utilization rate and the equilibrium index includes: A first score is determined based on the average resource utilization rate and the first weight of the average resource utilization rate; The second score is determined based on the equilibrium index and the second weight of the equilibrium index; A matching score is determined based on the first score and the second score.

7. The method according to any one of claims 3-6, characterized in that, The resource to be allocated is a virtual machine to be allocated, and the plurality of first objects are plurality of virtual machines to be allocated; Before determining at least one second object from a plurality of second objects that matches the first target object, the method further includes: Obtain the resource dependency of each virtual machine among multiple virtual machines; the resource dependency is used to indicate the degree to which the virtual machine depends on the resources provided by the physical node; Multiple virtual machines to be allocated are determined from the multiple virtual machines in descending order of resource dependency.

8. The method according to claim 7, characterized in that, The process of obtaining the resource dependency of each virtual machine among multiple virtual machines includes: Obtain the resource requirements of each of the plurality of virtual machines; Based on the resource requirements of each of the multiple virtual machines, the total resource requirements of the multiple virtual machines are determined. Based on the resource requirements of each virtual machine among the plurality of virtual machines and the total resource requirements, the resource dependency of each virtual machine among the plurality of virtual machines is determined.

9. The method according to claim 8, characterized in that, The resource requirements include N requirements for N types of resources, each of which represents the requirement for one type of resource among the N types of resources. The total resource requirements include N total requirements for the N types of resources, each of which represents the total requirement of the multiple virtual machines for one type of resource among the N types of resources, where N is an integer greater than 1. The determination of the resource dependency of each virtual machine based on its resource requirements and the total resource requirements includes: For the i-th resource among the N types of resources, based on the demand of each virtual machine for the i-th resource and the total demand of the virtual machines for the i-th resource, the resource demand rate of each virtual machine for the i-th resource is determined. Based on the N types of resources, determine the N resource demand rates for each of the plurality of virtual machines; Based on the N resource demand rates, the resource dependency of each virtual machine among the plurality of virtual machines is determined.

10. The method according to claim 9, characterized in that, The step of determining the resource dependency of each virtual machine among the plurality of virtual machines based on the N resource demand rates includes: Obtain the weight of each of the N types of resources; Based on the weight of each of the N types of resources and the demand rate of the N resources, the resource dependency of each virtual machine among the plurality of virtual machines is determined.

11. The method according to claim 10, characterized in that, The weight of each of the N resources is obtained based on the resource scarcity of each of the N resources, and the weight of each of the N resources is positively correlated with the resource scarcity of each of the N resources.

12. The method according to claim 11, characterized in that, The methods for obtaining resource scarcity include: Obtain the total amount of each of the N types of resources; Based on the total amount of each of the N resources and the total demand for each of the N resources, the resource scarcity of each of the N resources is determined.

13. The method according to claim 7, characterized in that, The plurality of resources to be allocated are M virtual machines to be allocated, and the M virtual machines to be allocated form an allocation queue; after allocating the resources to be allocated to the physical nodes, the method further includes: Remove the virtual machine to be allocated from the queue of allocated machines; If K virtual machines are removed from the queue to be allocated, K virtual machines are selected from the remaining virtual machines and added to the queue to be allocated, so that the queue to be allocated still contains M virtual machines to be allocated. The remaining virtual machines are those other than the M resources to be allocated among the plurality of virtual machines, where M and K are both positive integers and M is greater than K; the K virtual machines to be allocated removed from the allocation queue are allocated through concurrent scheduling.

14. The method according to claim 13, characterized in that, The plurality of physical nodes form a node queue; the method further includes: Remove a first specific physical node from the node queue, wherein the first specific physical node is a physical node that cannot meet the resource requirements of any virtual machine in the queue to be allocated; Add a second specific physical node to the node queue. The second specific physical node is a physical node that can meet the resource requirements of any virtual machine in the queue to be allocated.

15. The method according to any one of claims 1-6, characterized in that, Before allocating the resources to be allocated to physical nodes, the method further includes: Determine a second matching degree between the second target object and each of the plurality of first objects; Based on the second matching degree between the second target object and each of the plurality of first objects, at least one first object that matches the second target object is determined from the plurality of first objects.

16. The method according to claim 15, characterized in that, The at least one second object is the second target object, and the plurality of first objects includes at least two first objects, each of the at least two first objects matching the second target object; Determining at least one first object from the plurality of first objects that matches the second target object includes: From the at least two first objects, determine the single first object with the highest second matching degree to the second target object.

17. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 16.

18. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 16.

19. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 16.