Virtual machine scheduling method and device and storage medium

By determining the resource scores of nodes and virtual machines in the cluster platform and generating migration strategies, the problem of frequent source code updates in cluster management is solved, real-time and efficient cluster management is achieved, and maintenance costs are reduced.

CN120335937APending Publication Date: 2025-07-18INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510495101.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, cluster platforms need to continuously update source code to cope with changes in the types and scale of virtual machines, resulting in high maintenance costs and inability to achieve real-time and efficient cluster management.

Method used

By determining the resource scores of nodes and virtual machines in the cluster and entering them into the target migration policy model, a virtual machine migration policy is generated without updating the cluster source code, and virtual machines are scheduled.

Benefits of technology

It reduces maintenance costs, realizes real-time and efficient cluster management, and reduces the frequency of updates and maintenance of cluster source code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335937A_ABST
    Figure CN120335937A_ABST
Patent Text Reader

Abstract

The invention provides a virtual machine scheduling method and device and a storage medium. The method comprises the following steps: determining a first resource score of a node in a cluster and a second resource score of multiple resources of a virtual machine in the node; in response to a virtual machine migration event triggered by a first target node in the cluster, inputting the first resource scores of the nodes in the cluster and the second resource scores of the various resources of the virtual machine in each node into a target migration strategy model to obtain a virtual machine migration strategy; and scheduling the virtual machine in the first target node according to the virtual machine migration strategy. When the first target node in the cluster triggers the virtual machine migration event, the virtual machine migration strategy is obtained through the target migration strategy model, source codes in the cluster do not need to be updated and maintained, the maintenance cost is reduced, and real-time and efficient cluster management is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data processing, and in particular, to a virtual machine scheduling method, apparatus, and storage medium. Background Art

[0002] Currently, a cluster platform can evaluate the running state data of a cluster and determine whether a virtual machine in the cluster needs to be migrated based on the obtained evaluation results, so as to achieve load balancing management of the cluster.

[0003] Among them, the cluster can be evaluated by an artificial script according to the running state data of the nodes in the cluster. However, the types and scales of virtual machines in the cluster are constantly changing. Therefore, it is necessary to continuously update and maintain the source code in the cluster platform, resulting in high maintenance costs and inability to perform real-time and efficient cluster management. Summary of the Invention

[0004] The present disclosure provides a virtual machine scheduling method, apparatus, and system, which can obtain a virtual machine migration strategy in real time through a target migration strategy model, without updating and maintaining the source code in the cluster, reducing the maintenance cost, and realizing real-time and efficient cluster management.

[0005] To solve the above technical problems, the present disclosure provides a virtual machine scheduling method, including:

[0006] Determine a first resource score of a node in the cluster and second resource scores of multiple resources of virtual machines in the node;

[0007] In response to a virtual machine migration event triggered by a first target node in the cluster, input the first resource score of the nodes in the cluster and the second resource scores of multiple resources of virtual machines in each node into a target migration strategy model to obtain a virtual machine migration strategy;

[0008] Schedule the virtual machines in the first target node according to the virtual machine migration strategy.

[0009] An embodiment of the present disclosure further provides a virtual machine scheduling apparatus, including:

[0010] A first determination unit, configured to determine a first resource score of a node in the cluster and second resource scores of multiple resources of virtual machines in the node;

[0011] A second determination unit, configured to, in response to a virtual machine migration event triggered by a first target node in the cluster, input the first resource score of the nodes in the cluster and the second resource scores of multiple resources of virtual machines in each node into a target migration strategy model to obtain a virtual machine migration strategy;

[0012] A scheduling unit for scheduling virtual machines in the first target node according to the virtual machine migration policy.

[0013] An embodiment of the present disclosure also provides an electronic device, including:

[0014] A memory for storing a computer program;

[0015] A processor for implementing the steps of any virtual machine scheduling method provided by the embodiments of the present disclosure when executing the computer program.

[0016] An embodiment of the present disclosure also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any virtual machine scheduling method provided by the embodiments of the present disclosure.

[0017] An embodiment of the present disclosure also provides a computer program product including a computer program, which, when executed by a processor, implements the steps of any virtual machine scheduling method provided by the embodiments of the present disclosure.

[0018] A virtual machine scheduling method provided by the present disclosure includes: determining a first resource score of nodes in a cluster and second resource scores of multiple resources of virtual machines in a node; in response to a virtual machine migration event triggered by a first target node in the cluster, inputting the first resource score of nodes in the cluster and the second resource scores of multiple resources of virtual machines in each node into a target migration policy model to obtain a virtual machine migration policy; and scheduling the virtual machines in the first target node according to the virtual machine migration policy. When a virtual machine migration event is triggered by a first target node in the cluster, the first resource score of nodes in the cluster and the second resource scores of multiple resources of virtual machines in each node are input into the target migration policy model, so as to obtain a virtual machine migration policy, without the need to update and maintain the source code in the cluster, reducing the maintenance cost and realizing real-time and efficient cluster management.

[0019] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings

[0020] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0021] Figure 1 is a flowchart of a virtual machine scheduling method provided by an embodiment of the present disclosure;

[0022] Figure 2 is a schematic structural diagram of a cluster;

[0023] Figure 3 Flow diagram of another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0024] Figure 4 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0025] Figure 5 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0026] Figure 6 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0027] Figure 7 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0028] Figure 8 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0029] Figure 9 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0030] Figure 10 Flow diagram of yet another virtual machine scheduling method provided by an embodiment of the present disclosure;

[0031] Figure 11 Structure diagram of a virtual machine scheduling device provided by an embodiment of the present disclosure;

[0032] Figure 12 Structure diagram of another virtual machine scheduling device provided by an embodiment of the present disclosure;

[0033] Figure 13 Structure diagram of yet another virtual machine scheduling device provided by an embodiment of the present disclosure;

[0034] Figure 14 Structure diagram of yet another virtual machine scheduling device provided by an embodiment of the present disclosure. Detailed implementation

[0035] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to assist understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0036] Figure 1It is a schematic flowchart of a virtual machine scheduling method provided according to an embodiment of the present disclosure. As Figure 1 shown, the method may include the following steps:

[0037] Step 101, determine the first resource score of the nodes in the cluster and the second resource scores of various resources of the virtual machines in the nodes.

[0038] In some embodiments, Figure 2 a cluster architecture applicable to the embodiments of the present disclosure is proposed. As Figure 2 shown, the cluster includes multiple physical machine nodes, and one or more virtual machines are hosted on each node. Each node is an independent device, and multiple nodes form a cluster.

[0039] In some embodiments, each virtual machine has various resources allocated by the corresponding node. Among them, the various resources may include, but are not limited to, CPU (Central Processing Unit), GPU (Graphics Processing Unit), memory, and storage.

[0040] In some embodiments, by monitoring the running data of the node, the resource usage data of various resources of the node and the virtual machines in the node, and the resource allocation data of various resources in the node can be obtained. Based on the resource usage data of various resources of the virtual machines in the node and the resource allocation data of the node, the second resource scores of each resource of the virtual machines in the node can be determined, so that the resource usage data of the virtual machines can be quantified by scores, so that the virtual machine migration strategy can be determined according to the second resource scores subsequently.

[0041] In some embodiments, the third resource scores of each resource of the node can be determined based on the resource usage data of various resources of the node, and the first resource score of the node can be determined based on the third resource score of the node and the second resource score of the virtual machines in the node, so that the resource usage data of the node can be quantified by scores, so that the virtual machine migration strategy can be determined according to the first resource score subsequently.

[0042] Step 102, in response to a virtual machine migration event triggered by a first target node in the cluster, input the first resource score of the nodes in the cluster and the second resource scores of various resources of the virtual machines in each node into a target migration strategy model to obtain a virtual machine migration strategy.

[0043] In some embodiments, when a first target node in a cluster triggers a virtual machine migration event, the first resource scores of all nodes in the cluster obtained through the above steps and the second resource scores of various resources of the virtual machines within each node can be input into a target migration policy model to obtain a virtual machine migration policy. The virtual machine migration policy may include the virtual machines to be migrated out of the first target node and the nodes to which the virtual machines are migrated.

[0044] In some embodiments, based on the first resource score of the first target node and / or the third resource scores of each resource, it can be determined whether the first target node triggers a virtual machine migration event.

[0045] Specifically, in some embodiments, the method for determining whether the first target node triggers a virtual machine migration event based on the first resource score of the first target node and / or the third resource scores of each resource may include the following steps:

[0046] Step 1021, if the first resource score of the first target node is less than a first threshold, it is determined that the first target node triggers a virtual machine migration event; and / or

[0047] Step 1022, if the third resource score of the target resource of the first target node is greater than the second threshold of the target resource, it is determined that the first target node triggers a virtual machine migration event.

[0048] In some embodiments, the above target resource may be any one of various resources, and each resource has a corresponding second threshold.

[0049] In some embodiments, the above first threshold and second threshold can be set as needed.

[0050] Example 1, assume that the range of the first resource score is (0, 1), and the first threshold corresponding to the node is 0.7. That is, when the first resource score of the first target node is less than 0.7, it indicates that the load of this node is relatively high, and thus a virtual machine migration operation needs to be triggered to balance the resource status of each node, which can be used to comprehensively evaluate the running status of the cluster.

[0051] Example 2, assume that the third resource score is in a hundred - point system, and the second threshold corresponding to the CPU is 80. That is, when the third resource score of the CPU corresponding to the first target node is greater than 80, it indicates that the load of the CPU in this virtual machine is relatively high, and thus a virtual machine migration operation needs to be triggered. Here, corresponding settings can be made according to actual requirements.

[0052] Step 103, schedule the virtual machines in the first target node according to the virtual machine migration policy.

[0053] In some embodiments, after obtaining the virtual machine migration policy through the above steps, the virtual machines to be migrated in the first target node can be migrated to the nodes to be migrated according to the virtual machines to be migrated and the nodes to be migrated in the virtual machine migration policy, so as to complete the scheduling of the virtual machines in the first target node.

[0054] The virtual machine scheduling method provided by the embodiments of the present disclosure determines the first resource scores of the nodes in the cluster and the second resource scores of various resources of the virtual machines in the nodes; in response to the virtual machine migration event triggered by the first target node in the cluster, the first resource scores of the nodes in the cluster and the second resource scores of various resources of the virtual machines in each node are input into the target migration policy model to obtain a virtual machine migration policy; according to the virtual machine migration policy, the virtual machines in the first target node are scheduled. When the first target node in the cluster triggers a virtual machine migration event, the first resource scores of the nodes in the cluster and the second resource scores of various resources of the virtual machines in each node are input into the target migration policy model, so as to obtain a virtual machine migration policy, without the need to update and maintain the source code in the cluster, reducing the maintenance cost and realizing real-time and efficient cluster management.

[0055] In some embodiments, as a refinement of step 101, as Figure 3 shown, it may further include:

[0056] Step 301, obtaining the resource usage data of various resources of the nodes and the virtual machines in the nodes in the cluster.

[0057] In some embodiments, the resource data of various resources can also be determined as needed. Table 1 is a correspondence table of resources collected in nodes and virtual machines proposed by the embodiments of the present disclosure.

[0058] Table 1

[0059]

[0060] As shown in Table 1, the virtual machine running status and others in Table 1 can be customized and collected as needed. By way of example, assuming that the virtual machine is a database server, the corresponding database operation requests and database response times can be collected to represent the resource usage data of the virtual machine.

[0061] Step 302, determining the second resource scores of each resource of the virtual machines in the node based on the resource usage data of various resources of the virtual machines in the node and the resource allocation data of the node.

[0062] In some embodiments, the method for determining the second resource score of each resource of the virtual machine within the node based on the resource usage data of various resources of the virtual machine within the node and the resource allocation data of the node may include: determining the resource utilization rate of each resource based on the resource usage data of various resources of the virtual machine within the node and the resource allocation data of the node, and determining the second resource score of each resource of the virtual machine within the node based on the resource utilization rate of each resource and the target scoring system. Wherein, the resource allocation data of the above node is the total resource data of each resource of the node.

[0063] In some embodiments, the resource utilization rate of each resource can be determined through the resource usage data / resource allocation data of each resource of the virtual machine within the node. And, in some embodiments, the resource utilization rate of each resource can be multiplied by the target scoring system to obtain the sub-second resource score of each resource. The target scoring system can be set as needed. For example, the target scoring system is a hundred-mark system.

[0064] Exemplarily, assuming that the various resources include CPU and memory, and the target scoring system is a hundred-mark system, Table 2 is a corresponding table of the second resource score relationship of each resource proposed in the embodiments of the present disclosure.

[0065] Table 2

[0066] Resource Category Resource Utilization Rate Variable Representation Quantification Score CPU Actual CPU Usage of Virtual Machine / Total CPU of Node = 10% c1 10 Memory Actual Memory Usage of Virtual Machine / Total Memory of Node = 20% m1 20

[0067] As shown in Table 2, after obtaining the resource utilization rate of the CPU as 10%, the corresponding quantitative score can be obtained by 10%×100 as 10; after obtaining the resource utilization rate of the memory as 20%, the corresponding quantitative score can be obtained by 20%×100 as 20.

[0068] Step 303, determining the third resource score of each resource of the node based on the resource usage data of various resources of the node.

[0069] In some embodiments, the method for determining the third resource score of each resource of the node based on the resource usage data of various resources of the node may include: determining the resource utilization rate of each resource based on the resource usage data of each resource of the node and the resource allocation data of the node, and determining the third resource score of each resource of the node based on the resource utilization rate of each resource and the target scoring system. Exemplarily, Table 3 is a corresponding table of the third resource score relationship of each resource proposed in the embodiments of the present disclosure.

[0070] Table 3

[0071] Resource Category Resource Utilization Rate Variable Representation Quantification Score CPU Actual CPU Usage / Total CPU of Node = 80% C 80 Memory Actual Memory Usage / Total Memory of Node = 70% M 70

[0072] Step 304, determining the first resource score of the node within the cluster based on the third resource score of the node and the second resource score of the virtual machine within the node.

[0073] In some embodiments, after obtaining the third resource score of a node and the second resource score of the virtual machines within the node through the above steps, the first resource score of the nodes within the cluster can be determined based on the third resource score of the node and the second resource score of the virtual machines within the node.

[0074] Specifically, in some embodiments, the method for determining the first resource score of the nodes within the cluster based on the third resource score of the node and the second resource score of the virtual machines within the node may include: calculating and determining the first resource score of the nodes within the cluster through a first formula based on the third resource score of the node and the second resource score of the virtual machines within the node, where the first formula is:

[0075]

[0076] where n above is the number of virtual machines within the node, c i is the second resource score of the CPU corresponding to virtual machine i, m i is the second resource score of the memory corresponding to virtual machine i, L is the total amount of resources, and R is the third resource score of the node.

[0077] It should be noted that in some embodiments, the above node also includes the resources required for virtual machine scheduling. Based on this, is not equal to C, and

[0078] In some embodiments, in the above first formula, the first resource score R of the node can be determined according to the second resource scores of each resource of the virtual machines and the third resource scores of each resource of the node. At this time, R represents the actual score of the node working state after quantization and weighting of the resource usage data collected by the current node. Among them, according to the operating nature of the cluster, the value range of the above R value is (0, 1). And when the R value is closer to 1, it indicates that the resource overhead caused by virtual machine resource calls in the node is smaller, and the operating state of the node is healthier; when the R value is smaller, it indicates that the resource overhead caused by virtual machine resource calls in the node is larger, and at this time the node is likely to trigger a virtual machine migration event.

[0079] It should be noted that in some embodiments, through the above steps, the first resource score of the nodes within the cluster and the second resource scores of various resources of the virtual machines within the node can be obtained, so that the resource usage data of each node in the cluster can be quantitatively processed, and the operating state of the cluster can be evaluated according to the quantified first resource score.

[0080] In some embodiments, as a refinement of the virtual machine scheduling method, as Figure 4 shown, the above method may further include:

[0081] Step 401: Determine the training data for training the initial migration policy model.

[0082] In some embodiments, when a virtual machine migration event is triggered by a second target node within a historical time period, the target virtual machines to be migrated out in the second target node corresponding to the virtual machine migration event and the third target node to which the target virtual machines to be migrated out are to be migrated can be determined, and the first resource scores of the nodes in the cluster, the second resource scores of various resources of the virtual machines within each node, the second target node, the target virtual machines to be migrated out, and the third target node are determined as the training data for training the initial migration policy model.

[0083] Step 402: Use the training data to train the initial migration policy model to obtain a target migration policy model.

[0084] In some embodiments, after obtaining the training data for training the initial migration policy model through the above steps, the initial migration policy model can be trained using the training data to obtain a target migration policy model.

[0085] In some embodiments, the method of using the training data to train the initial migration policy model to obtain a target migration policy model may include the following steps:

[0086] Step 4021: Based on the training data, obtain the corresponding training data set and validation data set.

[0087] Step 4022: Train the initial migration policy model based on the training data set to obtain a trained migration policy model.

[0088] Step 4023: Use the validation data set to validate the trained migration policy model to obtain a target migration policy model.

[0089] In some embodiments, the processes of the above steps 4021 to 4023 are the same as those in the related art. For specific details, reference can be made to the detailed introduction of the related art, and the embodiments of the present disclosure will not be elaborated herein.

[0090] In some embodiments, after training is completed, the training data can also be continuously updated to expand the resource database of the model, so that the target migration policy model can continuously learn, thereby improving the prediction accuracy of the virtual machine migration policy.

[0091] In some embodiments, after determining the training data for training the initial migration policy model, the initial migration policy model can be trained using the training data to obtain a target migration policy model, so that when a virtual machine migration event is triggered by a first target node within the cluster, the virtual machine migration policy can be obtained through the target migration policy model, without the need to update and maintain the source code in the cluster, reducing the maintenance cost and achieving real-time and efficient cluster management.

[0092] In some embodiments, as a refined description of step 401, as Figure 5 shown, it may further include:

[0093] Step 501, when a virtual machine migration event is triggered by a second target node within a historical time period, based on the second resource scores of each virtual machine in the second target node, determine the target virtual machines to be migrated out in the second target node.

[0094] In some embodiments, the method for determining the target virtual machines to be migrated out in the second target node based on the second resource scores of each virtual machine in the second target node may include: after sequentially migrating out the virtual machines in the second target node based on the second resource scores of each virtual machine in the second target node, determine the fourth resource score corresponding to the second target node, and determine the virtual machine corresponding to the first one that satisfies the migration condition as the target virtual machine to be migrated out in the second target node.

[0095] In some embodiments, when the method for determining that the second target node triggers a migration event is different, the determined fourth resource score corresponding to the second target node is also different.

[0096] Specifically, in some embodiments, if it is determined that the second target node triggers a virtual machine migration event based on the first resource score of the second target node, the fourth resource score corresponding to the second target node may be determined by a second formula, where the second formula is:

[0097]

[0098] where p is the number of virtual machines in the second target node before the virtual machine to be migrated out, c v is the CPU usage of the migrated virtual machine v, m v is the memory usage of the migrated virtual machine v, L1 is the number of resources, and R1 is the fourth resource score.

[0099] In some embodiments, if it is determined that the second target node triggers a virtual machine migration event based on the third resource score of the target resource of the second target node, the resource score obtained by subtracting the second resource score of the target resource of the migrated virtual machine from the third resource score of the target resource may be determined as the fourth resource score corresponding to the second target node.

[0100] In some embodiments, if it is determined that the second target node triggers a virtual machine migration event based on the first resource score of the second target node and the third resource score of the target resource, the resource score determined by the above steps through the second formula and the resource score after subtracting the second resource score of the target resource of the virtual machine to be migrated out from the third resource score of the target resource can be determined as the fourth resource score corresponding to the second target node.

[0101] In some embodiments, after obtaining the fourth resource score of the second target node through the above steps, the virtual machine corresponding to the first one that makes the fourth resource score meet the migration-out condition can be determined as the target migration-out virtual machine to be migrated out in the second target node. Among them, if the fourth resource score does not trigger the virtual machine migration event of the second target node, it is determined that the fourth resource score meets the migration-out condition; otherwise, it is determined that the fourth resource score does not meet the migration-out condition.

[0102] In some embodiments, the virtual machines in the second target node can be randomly migrated out. If the fourth resource score after a certain virtual machine is migrated out meets the migration-out condition, the subsequent traversal process is stopped, and this virtual machine is determined as the target migration-out virtual machine to be migrated out in the second target node, thereby reducing the calculation process and reducing the calculation energy consumption.

[0103] Step 502, determine the third target node to which the target migration-out virtual machine migrates.

[0104] In some embodiments, it is possible to predict the fifth resource scores of each node in the remaining nodes after migrating the target migration-out virtual machine into the remaining nodes in the cluster except the second target node, and determine the third target node to which the target migration-out virtual machine migrates based on the fifth resource scores.

[0105] Step 503, determine the first resource score of the nodes in the cluster, the second resource scores of various resources of the virtual machines in each node, the second target node, the target migration-out virtual machine, and the third target node as the training data for training the initial migration policy model.

[0106] In some embodiments, based on the second resource scores of the virtual machines in the second target node, after sequentially migrating out the virtual machines in the second target node, the fourth resource score corresponding to the second target node is determined, and the virtual machine corresponding to the first one that makes the fourth resource score meet the migration-out condition is determined as the target migration-out virtual machine to be migrated out in the second target node. Based on this, if the fourth resource score of the second target node meets the migration-out condition after a certain virtual machine is migrated out, the subsequent traversal process is stopped, and this virtual machine is determined as the target migration-out virtual machine to be migrated out in the second target node, thereby reducing the calculation process and reducing the calculation energy consumption.

[0107] In some embodiments, as a refinement of step 502, such as Figure 6As shown, it may further include:

[0108] Step 601: Predict the fifth resource scores of each node among the remaining nodes after migrating the target virtual machine out of the virtual machine and into the remaining nodes in the cluster except the second target node.

[0109] In some embodiments, when the methods for determining the triggering migration events of the remaining nodes are different, the determined fifth resource scores of the remaining nodes are also different.

[0110] Specifically, in some embodiments, if it is determined that the remaining nodes trigger a virtual machine migration event based on the first resource scores of the remaining nodes, the fifth resource scores of the remaining nodes can be determined through the third formula, where the third formula is:

[0111]

[0112] where t is the number of virtual machines before migrating the virtual machine into the remaining nodes, c v is the CPU usage of the migrated virtual machine v, m v is the memory usage of the migrated virtual machine v, L2 is the number of resources, and R2 is the fifth resource score.

[0113] In some embodiments, if it is determined that the remaining nodes trigger a virtual machine migration event based on the third resource scores of the target resources of the remaining nodes, the resource score obtained by adding the third resource score of the target resources and the second resource score of the target resources of the migrated virtual machine can be determined as the fifth resource score corresponding to the second target node.

[0114] In some embodiments, if it is determined that the remaining nodes trigger a virtual machine migration event based on the first resource scores and the third resource scores of the target resources of the remaining nodes, the resource score determined through the second formula in the above steps and the resource score obtained by adding the third resource score of the target resources and the second resource score of the target resources of the migrated virtual machine can be determined as the fifth resource score corresponding to the remaining nodes.

[0115] Step 602: Sort the fifth resource scores and determine candidate migration nodes based on the obtained sorting result.

[0116] In some embodiments, the fifth resource scores can be sorted in descending order, and then based on the obtained descending sorting result, the nodes with a preset threshold ranking at the top can be determined as candidate migration nodes. The preset threshold can be set as needed. For example, the preset threshold is 3.

[0117] Step 603: Determine the third target node to which the target virtual machine to be migrated will be migrated based on the candidate migration nodes.

[0118] In some embodiments, the third target node to which the target migrated virtual machine migrates can be determined based on the fifth resource score of the candidate migrated-in node.

[0119] Specifically, in some embodiments, based on the ranking result, it is sequentially determined whether the fifth resource score of the candidate migrated-in node triggers the virtual machine migration event of the candidate migrated-in node, and the first candidate migrated-in node that does not trigger the virtual machine migration event is determined as the third target node to which the target migrated virtual machine migrates. Thus, the third target node to which the target migrated virtual machine migrates can be quickly determined, the calculation process is reduced, and the calculation energy consumption is reduced.

[0120] Based on the above description, Figure 7 FIG. is a schematic diagram of a virtual machine scheduling method proposed by an embodiment of the present disclosure.

[0121] As Figure 7 shown, assume that the cluster includes a first node host1 and a second node host2, and when the third resource score corresponding to the CPU of both host 1 and host2 is greater than 80, the virtual machine migration event is triggered; the second resource scores of the CPUs of all virtual machines in host1 are in sequence: 23 17 18 14 10; the second resource scores of the CPUs of all virtual machines in host2 are in sequence: 22 24; the third resource score corresponding to the CPU of host 1 is 90, and the third resource score corresponding to the CPU of host2 is 50; then at this time, host1 triggers the virtual machine migration policy, and it can be randomly determined to migrate the virtual machines in host 1 out. At this time, after migrating the virtual machine with a CPU score of 10 out of host1, the fourth resource score of host1 is 80. It is predicted that after migrating the virtual machine with a CPU score of 10 into host2, the fifth resource score of the CPU of host2 is 60. At this time, host1 still triggers the virtual machine migration event. Repeat the above steps. After randomly migrating the virtual machine with a CPU score of 14 out of host 1, the fourth resource score of host1 is 62. It is predicted that after migrating the virtual machine with a CPU score of 14 into host2, the fifth resource score of the CPU of host2 is 75. At this time, the virtual machine migration policies of host 1 and host2 are not triggered; the virtual machines with CPU scores of 10 and 14 are determined as the target migrated virtual machines, and host2 is determined as the target migrated-in node; and the third resource score 90 corresponding to the CPU of host 1 and the second resource scores 23 17 18 14 10 of the CPUs of each virtual machine in host1, the target migrated virtual machines and the target migrated-in node host2 are determined as the training data.

[0122] Based on the above description, Figure 8 FIG. is a schematic diagram of a virtual machine scheduling method proposed by an embodiment of the present disclosure.

[0123] AsFigure 8 As shown, it is assumed that the cluster includes a first node host1 and a second node host2, and when the third resource score corresponding to the CPU of both host 1 and host2 is greater than 80, a virtual machine migration event is triggered; the second resource scores of the CPUs of all virtual machines in host1 are: 23, 17, 18, 14, 10 in sequence; the second resource scores of the CPUs of all virtual machines in host2 are: 22, 24 in sequence; the third resource score corresponding to the CPU of host 1 is 90, and the third resource score corresponding to the CPU of host2 is 50; then at this time, host1 triggers the virtual machine migration policy, and the third resource score 90 corresponding to the CPU of host1 and the second resource scores 23, 17, 18, 14, 10 of the CPUs of each virtual machine in host1, the third resource score 50 corresponding to the CPU of host2 and the second resource scores 22, 24 of the CPUs of each virtual machine in host2 can be input into the target migration policy model, directly obtaining the target virtual machines to be migrated out, namely virtual machine 10 and virtual machine 14, and the target migration-in node is host2, without repeated operations for many times, reducing the maintenance cost and realizing real-time and efficient cluster management.

[0124] Based on the above description, Figure 9 FIG. is a schematic diagram of a virtual machine scheduling method proposed in an embodiment of the present disclosure.

[0125] As Figure 9As shown in the figure, assume that the cluster includes the first node host1 and the second node host2, and when the third resource score corresponding to the CPU of both host1 and host2 is greater than 80, a virtual machine migration event is triggered; the second resource scores of the CPUs of all virtual machines in host1 are in sequence: 23, 17, 18, 10; the second resource scores of the CPUs of all virtual machines in host2 are in sequence: 22, 24; the third resource score corresponding to the CPU of host1 is 70, and the third resource score corresponding to the CPU of host2 is 50; at this time, a virtual machine with a second resource score of 24 needs to be added to the cluster, and this virtual machine is added to host1. The second resource scores of the CPUs of all virtual machines in host1 are in sequence: 23, 17, 18, 10, 24, and the third resource score corresponding to the CPU of host1 is 90. Host1 triggers a virtual machine migration policy. Through the random migration-in policy, the virtual machines with CPU scores of 10 and 18 can be determined as the target migrated-out virtual machines. After the virtual machines are migrated out, the score of host1 is 70; it is predicted that after the virtual machines with CPU scores of 10 and 18 are migrated into host2, the fifth resource score of the CPU of host2 is 75, and the virtual machine migration event of host2 is not triggered. Then host2 is determined as the target migrated-in node; the third resource score 90 corresponding to the CPU of host1, the second resource scores 23, 17, 18, 10, 24 of the CPUs of each virtual machine in host1, the target migrated-out virtual machines 18 and 10, and the target migrated-in node host2 are determined as the training data.

[0126] Based on the above description, Figure 10 This is a schematic diagram of a virtual machine scheduling method proposed in an embodiment of the present disclosure.

[0127] As Figure 10As shown in the figure, it is assumed that the cluster includes a first node host1 and a second node host2, and when the third resource score corresponding to the CPU of both host1 and host2 is greater than 80, a virtual machine migration event is triggered; the second resource scores of the CPUs of all virtual machines in host1 are: 23, 17, 18, 10 in sequence; the second resource scores of the CPUs of all virtual machines in host2 are: 22, 24 in sequence; the third resource score corresponding to the CPU of host1 is 70, and the third resource score corresponding to the CPU of host2 is 50; at this time, a virtual machine with a second resource score of 24 needs to be added to the cluster, and this virtual machine is added to host1. The second resource scores of the CPUs of all virtual machines in host1 are: 23, 17, 18, 10, 28 in sequence, and the third resource score corresponding to the CPU of host1 is 90. Host1 triggers a virtual machine migration policy. Through the target migration policy model, it is obtained that the virtual machines with CPU scores of 10 and 18 are the target virtual machines to be migrated out, and host2 is the target migration-in node; after migrating the virtual machines with CPU scores of 10 and 18 to host2, the fifth resource score of the CPU of host2 is 75, and the virtual machine migration event of host2 is not triggered.

[0128] To implement the virtual machine scheduling method provided by the embodiments of the present disclosure, the embodiments of the present disclosure also provide a virtual machine scheduling device. As Figure 11 shown, it includes:

[0129] A first determination unit 111, configured to determine the first resource scores of the nodes in the cluster and the second resource scores of various resources of the virtual machines in the nodes;

[0130] A second determination unit 112, configured to, in response to a virtual machine migration event triggered by a first target node in the cluster, input the first resource scores of the nodes in the cluster and the second resource scores of various resources of the virtual machines in each node into the target migration policy model to obtain a virtual machine migration policy;

[0131] A scheduling unit 113, configured to schedule the virtual machines in the first target node according to the virtual machine migration policy.

[0132] The virtual machine scheduling device provided by the embodiments of the present disclosure determines the first resource score of nodes in the cluster and the second resource scores of various resources of virtual machines in the nodes; in response to a virtual machine migration event triggered by a first target node in the cluster, it inputs the first resource score of nodes in the cluster and the second resource scores of various resources of virtual machines in each node into a target migration policy model to obtain a virtual machine migration policy; and schedules the virtual machines in the first target node according to the virtual machine migration policy. When a virtual machine migration event is triggered by a first target node in the cluster, the first resource score of nodes in the cluster and the second resource scores of various resources of virtual machines in each node are input into the target migration policy model, so as to obtain a virtual machine migration policy, without the need to update and maintain the source code in the cluster, reducing the maintenance cost and realizing real-time and efficient cluster management.

[0133] Further, in a possible implementation manner of the embodiments of the present disclosure, as Figure 12 shown, the first determination unit 111 includes:

[0134] An acquisition module 1111, configured to acquire resource usage data of various resources of nodes in the cluster and virtual machines in the nodes;

[0135] A first determination module 1112, based on the resource usage data of various resources of virtual machines in the node and the resource allocation data of the node, determines the second resource scores of each resource of the virtual machine in the node;

[0136] A second determination module 1113, based on the resource usage data of various resources of the node, determines the third resource scores of each resource of the node;

[0137] A third determination module 1114, based on the third resource score of the node and the second resource score of the virtual machine in the node, determines the first resource score of the node in the cluster.

[0138] Further, in a possible implementation manner of the embodiments of the present disclosure, as Figure 13 shown, the above virtual machine scheduling device further includes a third determination unit 114,

[0139] The third determination unit 114 is configured to determine whether a virtual machine migration event is triggered by the first target node based on the first resource score of the first target node and / or the third resource scores of each resource.

[0140] Among them, the third determination unit 114 is specifically configured to:

[0141] If the first resource score of the first target node is less than the first threshold, it is determined that the first target node triggers a virtual machine migration event; and / or

[0142] If the third resource score of the target resource of the first target node is greater than the second threshold of the target resource, it is determined that the first target node triggers a virtual machine migration event.

[0143] Further, in a possible implementation manner of the embodiments of the present disclosure, as Figure 14 shown, the above virtual machine scheduling device further includes a fourth determination unit 115 and a training unit 116,

[0144] The fourth determination unit 115 is configured to determine training data for training an initial migration policy model;

[0145] The training unit 116 is configured to train the initial migration policy model using the training data to obtain a target migration policy model.

[0146] Among them, the fourth determination unit 115 is specifically configured to:

[0147] When the second target node triggers a virtual machine migration event within a historical time period, based on the second resource scores of each virtual machine in the second target node, determine the target virtual machines to be migrated out in the second target node;

[0148] Determine the third target node to which the target virtual machine to be migrated in;

[0149] Determine the first resource scores of the nodes in the cluster, the second resource scores of various resources of the virtual machines in each node, the second target node, the target virtual machine to be migrated out, and the third target node as the training data for training the initial migration policy model.

[0150] Further, the fourth determination unit 115 is further configured to:

[0151] Based on the second resource scores of each virtual machine in the second target node, after migrating out the virtual machines in the second target node in sequence, determine the fourth resource score corresponding to the second target node, and determine the virtual machine corresponding to the first one that makes the fourth resource score meet the migration-out condition as the target virtual machine to be migrated out in the second target node.

[0152] Further, the fourth determination unit 115 is further configured to:

[0153] Predict the fifth resource scores of each node in the remaining nodes after migrating the target virtual machine to be migrated in to the remaining nodes in the cluster except the second target node;

[0154] Sort the fifth resource scores, and determine candidate migration-in nodes based on the obtained sorting result;

[0155] Based on the candidate migration-in nodes, determine the third target node to which the target virtual machine to be migrated in.

[0156] Embodiments of the present disclosure also provide an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above embodiments of the virtual machine scheduling method.

[0157] Embodiments of the present disclosure also provide a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the above embodiments of the virtual machine scheduling method when running.

[0158] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as USB flash drives, read-only memories (ROM), random access memories (RAM), mobile hard disks, magnetic disks, or optical discs that can store computer programs.

[0159] Embodiments of the present disclosure also provide a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the virtual machine scheduling method.

[0160] Embodiments of the present disclosure also provide another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the virtual machine scheduling method.

[0161] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.

[0162] The above has introduced in detail a virtual machine scheduling method, device, and system provided by the present disclosure. Specific examples are used herein to elaborate on the principles and implementation manners of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principles of the present disclosure, several improvements and modifications can be made to the present disclosure, and these improvements and modifications also fall within the protection scope of the claims of the present disclosure.

Claims

1. A virtual machine scheduling method, characterized in that, Including: Determine the first resource score of nodes in the cluster and the second resource scores of various resources of virtual machines within the nodes; In response to a virtual machine migration event being triggered by a first target node in the cluster, input the first resource scores of the nodes in the cluster and the second resource scores of various resources of virtual machines within each node into a target migration policy model to obtain a virtual machine migration policy; Schedule the virtual machines in the first target node according to the virtual machine migration policy.

2. The virtual machine scheduling method according to claim 1, wherein The determining the first resource score of nodes in the cluster and the second resource scores of various resources of virtual machines within the nodes includes: Obtain the resource usage data of various resources of nodes and virtual machines within the nodes in the cluster; Based on the resource usage data of various resources of the virtual machines within the node and the resource allocation data of the node, determine the second resource scores of each resource of the virtual machines within the node; Based on the resource usage data of various resources of the node, determine the third resource scores of each resource of the node; Based on the third resource score of the node and the second resource score of the virtual machines within the node, determine the first resource score of the nodes in the cluster.

3. The virtual machine scheduling method according to claim 2, wherein Before the response to the virtual machine migration event being triggered by the first target node in the cluster, the method further includes: determining whether the first target node triggers a virtual machine migration event based on the first resource score of the first target node and / or the third resource scores of each resource; The determining whether the first target node triggers a virtual machine migration event based on the first resource score of the first target node and / or the third resource scores of each resource includes: If the first resource score of the first target node is less than a first threshold, determine that the first target node triggers a virtual machine migration event; and / or If the third resource score of the target resource of the first target node is greater than a second threshold of the target resource, determine that the first target node triggers a virtual machine migration event.

4. The virtual machine scheduling method according to claim 1, wherein The method further includes: Determine the training data for training an initial migration policy model; Use the training data to train the initial migration policy model to obtain a target migration policy model.

5. The virtual machine scheduling method according to claim 2, wherein The determining the training data for training an initial migration policy model includes: When a second target node triggers a virtual machine migration event within a historical time period, based on the second resource scores of each virtual machine in the second target node, determine the target virtual machines to be migrated out in the second target node; Determine the third target node into which the target virtual machines to be migrated out are migrated; Determine the first resource scores of the nodes in the cluster, the second resource scores of various resources of virtual machines within each node, the second target node, the target virtual machines to be migrated out, and the third target node as the training data for training the initial migration policy model.

6. The virtual machine scheduling method according to claim 5, wherein The determining the target virtual machines to be migrated out in the second target node based on the second resource scores of each virtual machine in the second target node includes: After successively migrating out the virtual machines in the second target node based on the second resource scores of the virtual machines in the second target node, determining the fourth resource score corresponding to the second target node, and determining the virtual machine corresponding to the first fourth resource score that meets the migration-out condition as the target migration-out virtual machine that needs to be migrated out in the second target node.

7. The virtual machine scheduling method according to claim 5, wherein The determining the third target node for the target migration-out virtual machine to migrate into includes: Predicting the fifth resource scores of each node in the remaining nodes in the cluster after migrating the target migration-out virtual machine into the remaining nodes in the cluster except the second target node; Sorting the fifth resource scores and determining candidate migration-in nodes based on the obtained sorting result; Based on the candidate migration-in nodes, determining the third target node for the target migration-out virtual machine to migrate into.

8. A virtual machine scheduling device, characterized in that, Including: A first determination unit, configured to determine the first resource score of the nodes in the cluster and the second resource scores of various resources of the virtual machines in the nodes; A second determination unit, configured to, in response to a virtual machine migration event triggered by a first target node in the cluster, input the first resource score of the nodes in the cluster and the second resource scores of various resources of the virtual machines in each node into a target migration policy model to obtain a virtual machine migration policy; A scheduling unit, configured to schedule the virtual machines in the first target node according to the virtual machine migration policy.

9. An electronic device, characterized in that, Including: A memory, configured to store a computer program; A processor, configured to implement the steps of the virtual machine scheduling method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program, when executed by a processor, implements the steps of the virtual machine scheduling method according to any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the virtual machine scheduling method according to any one of claims 1 to 7.